You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Alberto Torres (Jira)" <ji...@apache.org> on 2021/11/03 12:12:00 UTC
[jira] [Updated] (ARROW-14569) Support for pandas Categoricals with
Intervals
[ https://issues.apache.org/jira/browse/ARROW-14569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alberto Torres updated ARROW-14569:
-----------------------------------
Description:
Trying to write a pandas categorical created from `pd.cut` fails with the following error:
{code:python}
df_test = pd.DataFrame({"cat": pd.cut([1, 2, 3, 4, 5], bins=[2, 4])})
df_test.to_parquet("test.parquet")
{code}
{code:python}
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)
{code}
The problems seems to be the interval dtype. Specifing the `labels` keyword solved the problem.
was:
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.
> 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
> Priority: Minor
>
> Trying to write a pandas categorical created from `pd.cut` fails with the following error:
> {code:python}
> df_test = pd.DataFrame({"cat": pd.cut([1, 2, 3, 4, 5], bins=[2, 4])})
> df_test.to_parquet("test.parquet")
> {code}
> {code:python}
> 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)
> {code}
> 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)