Skip to content

API: Index(object_dtype_bool_ndarray) retain object dtype #49594

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
Nov 9, 2022

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@mroeschke
Copy link
Member

Just to solidify the "rule of thumb" where this is headed

pd.Index/Series(np.array([...], dtype=object), dtype=None) -> object
pd.Index/Series(np.array([...], dtype=object), dtype=other) == pd.Index/Series(np.array([...], dtype=object)).astype(other)

?

@mroeschke mroeschke added the Dtype Conversions Unexpected or buggy dtype conversions label Nov 9, 2022
@mroeschke mroeschke added this to the 2.0 milestone Nov 9, 2022
@mroeschke mroeschke merged commit e8b43b6 into pandas-dev:main Nov 9, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel
Copy link
Member Author

jbrockmendel commented Nov 9, 2022

Just to solidify the "rule of thumb" where this is headed [...]

Not quite. In the pd.Index/Series(ndarray_object) case we'll continue to do inference on datetime, timedelta, interval, and period.

(and more generally id have no strong objection to doing inference on numeric/bool dtypes, just as long as we're consistent about it)

@jbrockmendel jbrockmendel deleted the api-index-bools branch November 9, 2022 17:41
phofl pushed a commit to phofl/pandas that referenced this pull request Nov 9, 2022
…#49594)

* API: Index(object_dtype_bool_ndarray) retain object dtype

* GH ref, test
codamuse pushed a commit to codamuse/pandas that referenced this pull request Nov 12, 2022
…#49594)

* API: Index(object_dtype_bool_ndarray) retain object dtype

* GH ref, test
mliu08 pushed a commit to mliu08/pandas that referenced this pull request Nov 27, 2022
…#49594)

* API: Index(object_dtype_bool_ndarray) retain object dtype

* GH ref, test
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants