AlenkaF commented on issue #38171:
URL: https://github.com/apache/arrow/issues/38171#issuecomment-1754492554
What version of pandas are you using?
If I use pyarrow 13.0.0 and pandas 2.1.1, with small table/dataframe reprex
using pyarrow reading and writing to parquet, I can not reproduce the failure.
Note that I started with pyarrow table as the bytes you have added in the
example are not clear to me (how to generate them?)
```python
>>> pa.__version__
'13.0.0'
>>> pd.__version__
'2.1.1'
# create pyarrow table with timestamp[ns]
>>> from datetime import datetime
>>> table = pa.table([pa.array([datetime(2012, 1, 1)],
type=pa.timestamp('ns'))],
... names=["a"])
# converting to pandas -> correct datetime64[ns]
>>> table.to_pandas().dtypes
a datetime64[ns]
dtype: object
# Writing to parquet and reading from it -> correct timestamp[ns]
>>> pq.write_table(table,"test")
>>> pq.read_table("test").schema
a: timestamp[ns]
# Converting to pandas -> correct datetime64[ns]
>>> pq.read_table("test").to_pandas().dtypes
a datetime64[ns]
dtype: object
# Using pandas read_parquet -> correct datetime64[ns]
>>> pd.read_parquet("test").dtypes
a datetime64[ns]
dtype: object
```
Also using only pandas, it works for me. That is `datetime64[ns]` is not
changed:
```python
>>> df = table.to_pandas()
>>> df.dtypes
a datetime64[ns]
dtype: object
>>> df.to_parquet("test_2")
>>> pd.read_parquet("test_2").dtypes
a datetime64[ns]
dtype: object
```
--
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]