Closed
Description
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]