Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Roundtripping with from_pandas().to_pandas() changes timestamp/timedelta resolution #34877

Closed
phofl opened this issue Apr 4, 2023 · 2 comments

Comments

@phofl
Copy link
Contributor

phofl commented Apr 4, 2023

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

With pandas 2.0 we support more resolutions than nanosecond resolution. E.g. the following should preserve the reso:

import pandas as pd
import pyarrow as pa
df = DataFrame({"a": [np.datetime64("2022-01-01")]}, dtype="datetime64[s]")
result = pa.Table.from_pandas(df).to_pandas()
result.dtypes
a    datetime64[ns]
dtype: object

Expected:

a    datetime64[s]
dtype: object

Tried on the latest nightly build

Component(s)

Python

@jorisvandenbossche
Copy link
Member

Yes, this is known, historically we have hardcoded nanoseconds, which we can relax if pandas>=2 is installed.

See #33321, going to close this as a duplicate

@jorisvandenbossche
Copy link
Member

Duplicate of #33321

@jorisvandenbossche jorisvandenbossche marked this as a duplicate of #33321 Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants