Skip to content

REF: simplify EA.astype #44133

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

Merged
merged 2 commits into from
Oct 24, 2021
Merged

REF: simplify EA.astype #44133

merged 2 commits into from
Oct 24, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

@simonjayhawkins
Copy link
Member

Thanks @jbrockmendel do we need to include any additional tests to the base extension tests for the benefit of 3rd party EA devs?

@simonjayhawkins simonjayhawkins added ExtensionArray Extending pandas with custom dtypes or arrays. Refactor Internal refactoring of code labels Oct 22, 2021
@simonjayhawkins simonjayhawkins added this to the 1.4 milestone Oct 22, 2021
@simonjayhawkins simonjayhawkins added the Dtype Conversions Unexpected or buggy dtype conversions label Oct 22, 2021
@jbrockmendel
Copy link
Member Author

do we need to include any additional tests to the base extension tests for the benefit of 3rd party EA devs?

I don't think so, doesnt change what authors are expected to implement

@simonjayhawkins
Copy link
Member

unless they have already implemented their own astype method I assume?

@jbrockmendel
Copy link
Member Author

I don't understand the question

@simonjayhawkins
Copy link
Member

I'm thinking that at the moment we don't support astype(EADType) except StringDType (for which IIRC we added tests to the base extension tests) unless we have implemented specifically it in the child classes.

Adding support in the base class for any EADType.astype(EADType) now means that we don't generate errors doing this from the main codebase and therefore all EA subclasses will now need to support this. EA authors that have implemented astype before this requirement may not support this?

@jbrockmendel
Copy link
Member Author

OK I see. I don't think this changes what we expect from EA authors. I guess we could test that doing an .astype to PandasDtype[object] works, Categorical following #43930 would be more meaningful. Did you have something else in mind?

@jreback jreback merged commit dc3c4b7 into pandas-dev:master Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions ExtensionArray Extending pandas with custom dtypes or arrays. Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants