Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-1992

[Python] to_pandas crashes when using strings_to_categoricals on empty string cols on 0.8.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.8.0
    • 0.9.0
    • Python
    • OS: Windows
      Python: PY36 x64
      Pandas: 0.22.0
      pyarrow: 0.8.0

    Description

      When trying to read back a table, Python crashes when pyarrow is used to read/convert a table that has a column of 0 length `strings and strings_to_categorical=True`. Example code below.
      This same test ran ok with pyarrow 0.7.1

      import pandas as pd
      import pyarrow as pa
      
      df = pd.DataFrame({
          'Foo': ['A', 'A', 'B', 'B', 'C'],
          'Bar': ['A1', 'A2', 'B2', 'D3', ''],
          'Baz': ['', '', '', '', ''],
      })
      
      table = pa.Table.from_pandas(df)
      
      df = table.to_pandas(strings_to_categorical=False)  # Works
      print('Categoricals=False', len(df))
      
      df = table.to_pandas(strings_to_categorical=True)  # Crashes
      print('Categoricals=True', len(df))
      

      Attachments

        Issue Links

          Activity

            People

              Licht-T Licht Takeuchi
              vmuriart Victor Uriarte
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: