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

[Python] Create UnionArray from mixed-type pandas categorical

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 0.10.0
    • None
    • Python
    • None

    Description

      While troublehsooting ARROW-2966 I updated my pandas dataframe with more type information. Specifically, I changed some mixed type columns to categorical instead of object. I assumed that the Table.from_pandas() would inspect the pandas type information and respect that when converting it over to a table. It doesn't seem to.

      For instance, I expected this code to work, but it throws the same ArrowTypeError as ARROW-2966.

       

      import pandas as pd
      import pyarrow as pa
      import numpy as np
      df=pd.DataFrame.from_dict({"col":[0,1,2,3,""]},dtype="category")
      tb = pa.Table.from_pandas(df, columns=["col"])
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              brooksch Christopher Brooks
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: