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

ENH: support apply method for ExtensionArray backed DataFrame #54584

Open
1 of 3 tasks
andrewgsavage opened this issue Aug 16, 2023 · 0 comments
Open
1 of 3 tasks

ENH: support apply method for ExtensionArray backed DataFrame #54584

andrewgsavage opened this issue Aug 16, 2023 · 0 comments
Labels
Apply Apply, Aggregate, Transform, Map Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. Needs Discussion Requires discussion from core team before further action

Comments

@andrewgsavage
Copy link

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

@andrewgsavage andrewgsavage added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 16, 2023
@mroeschke mroeschke added Needs Discussion Requires discussion from core team before further action Apply Apply, Aggregate, Transform, Map ExtensionArray Extending pandas with custom dtypes or arrays. and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. Needs Discussion Requires discussion from core team before further action
Projects
None yet
Development

No branches or pull requests

2 participants