-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
ApplyApply, Aggregate, Transform, MapApply, Aggregate, Transform, MapEnhancementExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionpyarrow dtype retentionop with pyarrow dtype -> expect pyarrow resultop with pyarrow dtype -> expect pyarrow result
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
Following on from #28955, there's an issue in pint-pandas for apply with DataFrames. Ideally res would be a PintArray rather than an array of objects.
import pandas as pd
import pint
import pint_pandas
ureg = pint.get_application_registry()
def g(x):
return x[0]
df = pd.DataFrame({'A':pd.Series([1,2,3,4], dtype='pint[day]'),'B':pd.Series([5,6,7,8], dtype='pint[day]')})
res = df.apply(g)
res
A 1 day
B 5 day
dtype: object
Feature Description
This may require the same solution as #27995. Alternatively a dtype arguement for apply.
Alternative Solutions
N/A
Additional Context
No response
Metadata
Metadata
Assignees
Labels
ApplyApply, Aggregate, Transform, MapApply, Aggregate, Transform, MapEnhancementExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionpyarrow dtype retentionop with pyarrow dtype -> expect pyarrow resultop with pyarrow dtype -> expect pyarrow result