apache / apache/arrow

[Python] Writing pandas.DataFrame containing a object dtype column with int values fails

Open
#43,298 3 comments 2 reactions 0 assignees View on GitHub
Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

I have a pandas.DataFrame with column 电源状态 whose unique values are :

df['电源状态'].unique() -> array(['静置', 'CC充电', 'CC放电', 'CV', 46], dtype=object)
df['电源状态'].dtype -> dtype('O') (dtype auto generated during read)

Upon performing df.to_feather('test.feather'), the following error raises:

ArrowTypeError: ("Expected bytes, got a 'int' object", 'Conversion failed for column 电源状态 with type object')

### Component(s)

Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.