Skip to content

COMPAT: can we reduce pathological cases in Index comparisons #13286

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

Open
jreback opened this issue May 25, 2016 · 2 comments
Open

COMPAT: can we reduce pathological cases in Index comparisons #13286

jreback opened this issue May 25, 2016 · 2 comments
Labels
API - Consistency Internal Consistency of API/Behavior Bug Constructors Series/DataFrame/Index/pd.array Constructors Datetime Datetime data dtype Index Related to the Index class or subclasses

Comments

@jreback
Copy link
Contributor

jreback commented May 25, 2016

from SO

In [1]: i1 = pd.DatetimeIndex(['1971-10-01'], dtype='datetime64[ns]', freq=None)

In [2]: i2 = pd.Index([u'100171'], dtype='object')

In [3]: i1
Out[3]: DatetimeIndex(['1971-10-01'], dtype='datetime64[ns]', freq=None)

In [4]: pd.DatetimeIndex(i2)
Out[4]: DatetimeIndex(['1971-10-01'], dtype='datetime64[ns]', freq=None)

We might be able to elminate the coercion in .equals() in some cases.

@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves Dtype Conversions Unexpected or buggy dtype conversions Difficulty Advanced labels May 25, 2016
@jreback jreback added this to the Next Major Release milestone May 25, 2016
@sinhrks
Copy link
Member

sinhrks commented May 26, 2016

Met the same issue when fixing #13107. How about stop coercing normal Index if its inferred_dtype is string like?

@jreback
Copy link
Contributor Author

jreback commented May 26, 2016

I agree I think coercion needs to be explicit
actually I don't think we should wrap in DTI at all
of its not already the same class that it's not equal

@toobaz toobaz added Index Related to the Index class or subclasses and removed Indexing Related to indexing on series/frames, not to indexes themselves labels Jun 28, 2019
@mroeschke mroeschke added Bug Datetime Datetime data dtype Constructors Series/DataFrame/Index/pd.array Constructors and removed Dtype Conversions Unexpected or buggy dtype conversions labels May 5, 2020
@jbrockmendel jbrockmendel added the API - Consistency Internal Consistency of API/Behavior label Sep 21, 2020
@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Bug Constructors Series/DataFrame/Index/pd.array Constructors Datetime Datetime data dtype Index Related to the Index class or subclasses
Projects
None yet
Development

No branches or pull requests

5 participants