Skip to content

"is_all_dates" inconsistent across datetimelike types #19204

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

Closed
toobaz opened this issue Jan 12, 2018 · 5 comments
Closed

"is_all_dates" inconsistent across datetimelike types #19204

toobaz opened this issue Jan 12, 2018 · 5 comments
Labels
API Design Bug Datetime Datetime data dtype Dtype Conversions Unexpected or buggy dtype conversions good first issue Period Period data type Timedelta Timedelta data type

Comments

@toobaz
Copy link
Member

toobaz commented Jan 12, 2018

xref #19187

Code Sample, a copy-pastable example if possible

In [2]: pd.DatetimeIndex(['2000-02-01', '2000-02-02']).is_all_dates
Out[2]: True

In [3]: pd.DatetimeIndex(['2000-02-01', '2000-02-02']).append(pd.Index(['not a date']))[:2].is_all_dates
Out[3]: True

In [4]: pd.PeriodIndex(['2000', '2001'], freq='A').is_all_dates
Out[4]: True

In [5]: pd.PeriodIndex(['2000', '2001'], freq='A').append(pd.Index(['not a date']))[:2].is_all_dates
Out[5]: False

In [6]: pd.TimedeltaIndex([2000, 2001]).append(pd.Index(['not a date']))[:2].is_all_dates
Out[6]: False

Problem description

is_all_dates is smart for object indexes but only for DatetimeIndex, which is inconsistent since the other datetimelike indexes are also considered is_all_dates.

Expected Output

Out[5]: and Out[6]: should be the same as Out[3]:.

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

@jreback
Copy link
Contributor

jreback commented Jan 12, 2018

this should be made more like the other is_* methods (in base.py), where it simply checks the inferred type (and then checks for object), needs a doc-string

@jreback jreback added Datetime Datetime data dtype Dtype Conversions Unexpected or buggy dtype conversions API Design Timedelta Timedelta data type Period Period data type Effort Low good first issue labels Jan 12, 2018
@jreback jreback added this to the Next Major Release milestone Jan 12, 2018
@giba0
Copy link
Contributor

giba0 commented Feb 12, 2018

I'm a newbie here and I'm in search of fun! Can I help you with that? =)

@TomAugspurger
Copy link
Contributor

@gilbertoolimpio yep, that'd be great. Do you know where to start?

@toobaz
Copy link
Member Author

toobaz commented Feb 17, 2018

this should be made more like the other is_* methods (in base.py), where it simply checks the inferred type (and then checks for object), needs a doc-string

I suggest then to just deprecate it, since it becomes equivalent to a simple isisntance call, only more misterious.

@mroeschke mroeschke added the Bug label Apr 1, 2020
addammy added a commit to addammy/pandas that referenced this issue Apr 11, 2020
…) - improved tests, removed unnecessary imports
addammy added a commit to addammy/pandas that referenced this issue Apr 16, 2020
…) - improved tests, removed unnecessary imports
addammy added a commit to addammy/pandas that referenced this issue May 4, 2020
…) - improved tests, removed unnecessary imports
addammy added a commit to addammy/pandas that referenced this issue May 4, 2020
@jbrockmendel
Copy link
Member

closed by #36697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Datetime Datetime data dtype Dtype Conversions Unexpected or buggy dtype conversions good first issue Period Period data type Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants