Skip to content

Commit 4505517

Browse files
committed
BUG: DatetimeIndex._data should return an ndarray
1 parent 3dd90a2 commit 4505517

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

doc/source/whatsnew/v0.23.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ Other API Changes
966966
- Constructing a Series from a list of length 1 no longer broadcasts this list when a longer index is specified (:issue:`19714`, :issue:`20391`).
967967
- :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`)
968968
- 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`)
969+
- ``DatetimeIndex._data`` now returns a numpy array in all cases (:issue:`20810`)
969970

970971
.. _whatsnew_0230.deprecations:
971972

pandas/core/indexes/datetimes.py

+3
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ def _simple_new(cls, values, name=None, freq=None, tz=None,
630630
if we are passed a non-dtype compat, then coerce using the constructor
631631
"""
632632

633+
if isinstance(values, DatetimeIndex):
634+
values = values.values
635+
633636
if getattr(values, 'dtype', None) is None:
634637
# empty, but with dtype compat
635638
if values is None:

0 commit comments

Comments
 (0)