You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Alberto Torres (Jira)" <ji...@apache.org> on 2021/11/03 12:10:00 UTC

[jira] [Created] (ARROW-14569) Support for pandas Categoricals with Intervals

Alberto Torres created ARROW-14569:
--------------------------------------

             Summary: Support for pandas Categoricals with Intervals
                 Key: ARROW-14569
                 URL: https://issues.apache.org/jira/browse/ARROW-14569
             Project: Apache Arrow
          Issue Type: New Feature
          Components: Python
    Affects Versions: 6.0.0
            Reporter: Alberto Torres


Trying to write a pandas categorical created from `pd.cut` fails with the following error:

 

```

df_test = pd.DataFrame(\{"cat": pd.cut([1, 2, 3, 4, 5], [2, 4])})

df_test.to_parquet("test.parquet")

```

 

```

File "pyarrow/error.pxi", line 120, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Unsupported cast from dictionary<values=extension<pandas.interval<ArrowIntervalType>>, indices=int8, ordered=1> to extension<pandas.interval<ArrowIntervalType>> (no available cast function for target type)

```

 

The problems seems to be the interval dtype. Specifing the `labels` keyword solved the problem.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)