AlenkaF commented on issue #15133:
URL: https://github.com/apache/arrow/issues/15133#issuecomment-1372403747
Oh sorry, didn't check myself to be sure.
Changing the type on the pandas side should work, like so:
```python
import pyarrow as pa
import pandas as pd
df = pd.DataFrame(({
'a': ['a', 'a', 'a', 'b', 'b', 'b', 'c'],
'b': [1, 2, None, 4, 5, 1, 0],
'c': [1.5, 2.0, 3.5, 5.0, 8.0, 10.0, 'a string'],
}))
df['c'] = df['c'].astype('str')
pa.Table.from_pandas(df)
# pyarrow.Table
# a: string
# b: double
# c: string
# ----
# a: [["a","a","a","b","b","b","c"]]
# b: [[1,2,null,4,5,1,0]]
# c: [["1.5","2.0","3.5","5.0","8.0","10.0","a string"]]
df.to_feather('file')
pd.read_feather('file')
# a b c
# 0 a 1.0 1.5
# 1 a 2.0 2.0
# 2 a NaN 3.5
# 3 b 4.0 5.0
# 4 b 5.0 8.0
# 5 b 1.0 10.0
# 6 c 0.0 a string
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]