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] duration[arrow] support in pandas #38805

Open
sergun opened this issue Nov 20, 2023 · 1 comment
Open

[Python] duration[arrow] support in pandas #38805

sergun opened this issue Nov 20, 2023 · 1 comment
Labels
Component: Python Type: usage Issue is a user question

Comments

@sergun
Copy link

sergun commented Nov 20, 2023

Describe the usage question you have. Please include as many useful details as possible.

Is type duration[pyarrow] supported in pandas?

This piece of code creates pd.DataFrame with column "a" of type duration[pyarrow]:

from datetime import datetime
import pyarrow as pa
x = pa.table([[datetime.now()]], ["a"])
y = pa.table([[datetime.now()]], ["a"])
df = x.to_pandas(types_mapper=pd.ArrowDtype)-y.to_pandas(types_mapper=pd.ArrowDtype))
print(df.types)
a    duration[us][pyarrow]
dtype: object

But this line:

print(df["a"].dt.days)

raises exception:

AttributeError: Can only use .dt accessor with datetimelike values. Did you mean: 'at'?

Is it a bug or limited support of arrow types in pandas for now?

Component(s)

Python

@sergun sergun added the Type: usage Issue is a user question label Nov 20, 2023
@rohanjain101
Copy link

pandas-dev/pandas#52284

#33962

Seems like Timedelta accessor not supported with arrow backend yet since there aren't any arrow compute methods to extract Timedelta components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Python Type: usage Issue is a user question
Projects
None yet
Development

No branches or pull requests

2 participants