Skip to content

Commit ee1bcba

Browse files
committed
BUG: DatetimeIndex._data should return an ndarray
1 parent 4274b84 commit ee1bcba

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
@@ -632,6 +632,9 @@ def _simple_new(cls, values, name=None, freq=None, tz=None,
632632
if we are passed a non-dtype compat, then coerce using the constructor
633633
"""
634634

635+
if isinstance(values, DatetimeIndex):
636+
values = values.values
637+
635638
if getattr(values, 'dtype', None) is None:
636639
# empty, but with dtype compat
637640
if values is None:

0 commit comments

Comments
 (0)