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

REF: dtypes.cast #38119

Closed
jbrockmendel opened this issue Nov 27, 2020 · 2 comments
Closed

REF: dtypes.cast #38119

jbrockmendel opened this issue Nov 27, 2020 · 2 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@jbrockmendel
Copy link
Member

There are too many functions in dtypes.cast, making it difficult to know which one to use in a given situation. e.g. when working with Index.insert in #38102 I considered maybe_promote, maybe_upcast, maybe_casted_values, find_common_type.

Best case scenario we can de-duplicate some of these and just remove some of them, but failing that, I think we could find new homes for e.g. construct_1d_arraylike_from_scalar, construct_1d_object_array_from_listlike, construct_1d_ndarray_preserving_na.

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 27, 2020
@jreback
Copy link
Contributor

jreback commented Nov 27, 2020

would start by making a submodule and organizing

@jbrockmendel
Copy link
Member Author

There are a couple of functions in here that are basically disguised Series/DataFrame methods, in particular cast.convert_dtypes is effectively Series._convert_dtypes, cast.maybe_casted_values is only used in DataFrame.reset_index. These aren't re-usable low-level functions (which is how i like to think of core.dtypes, but I guess it doesn't have to be that way), but I'm not eager to move code into Series/DataFrame, so not obvious how to handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants