Skip to content

Commit 0a0252c

Browse files
committed
BUG: DatetimeIndex._data should return an ndarray
1 parent c2da06c commit 0a0252c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

doc/source/whatsnew/v0.23.0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@ Other API Changes
996996
- :func:`DataFrame.to_dict` with ``orient='index'`` no longer casts int columns to float for a DataFrame with only int and float columns (:issue:`18580`)
997997
- A user-defined-function that is passed to :func:`Series.rolling().aggregate() <pandas.core.window.Rolling.aggregate>`, :func:`DataFrame.rolling().aggregate() <pandas.core.window.Rolling.aggregate>`, or its expanding cousins, will now *always* be passed a ``Series``, rather than a ``np.array``; ``.apply()`` only has the ``raw`` keyword, see :ref:`here <whatsnew_0230.enhancements.window_raw>`. This is consistent with the signatures of ``.aggregate()`` across pandas (:issue:`20584`)
998998
- Rolling and Expanding types raise ``NotImplementedError`` upon iteration (:issue:`11704`).
999+
- ``DatetimeIndex._data`` now returns a numpy array in all cases (:issue:`20810`)
9991000

10001001
.. _whatsnew_0230.deprecations:
10011002

pandas/core/indexes/datetimes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ def _simple_new(cls, values, name=None, freq=None, tz=None,
619619
if we are passed a non-dtype compat, then coerce using the constructor
620620
"""
621621

622+
if isinstance(values, DatetimeIndex):
623+
values = values.values
624+
622625
if getattr(values, 'dtype', None) is None:
623626
# empty, but with dtype compat
624627
if values is None:

0 commit comments

Comments
 (0)