diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 29f360e050548..dcc9aa9f84545 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -71,7 +71,7 @@ Below is a possibly non-exhaustive list of changes: e.g. ``Index([1, 2, 3])`` will have a ``int64`` dtype, which is the same as previously. 2. The various numeric datetime attributes of :class:`DatetimeIndex` (:attr:`~DatetimeIndex.day`, :attr:`~DatetimeIndex.month`, :attr:`~DatetimeIndex.year` etc.) were previously in of - dtype ``int64``, while they were ``int32`` for :class:`DatetimeArray`. They are now + dtype ``int64``, while they were ``int32`` for :class:`arrays.DatetimeArray`. They are now ``int32`` on ``DatetimeIndex`` also: .. ipython:: python @@ -610,7 +610,7 @@ Empty DataFrames/Series will now default to have a ``RangeIndex`` Before, constructing an empty (where ``data`` is ``None`` or an empty list-like argument) :class:`Series` or :class:`DataFrame` without specifying the axes (``index=None``, ``columns=None``) would return the axes as empty :class:`Index` with object dtype. -Now, the axes return an empty :class:`RangeIndex`. +Now, the axes return an empty :class:`RangeIndex` (:issue:`49572`). *Previous behavior*: diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 3e4d184ecdf47..64dde64371e29 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -132,6 +132,11 @@ class DatetimeIndex(DatetimeTimedeltaMixin): Represented internally as int64, and which can be boxed to Timestamp objects that are subclasses of datetime and carry metadata. + .. versionchanged:: 2.0.0 + The various numeric date/time attributes (:attr:`~DatetimeIndex.day`, + :attr:`~DatetimeIndex.month`, :attr:`~DatetimeIndex.year` etc.) now have dtype + ``int32``. Previously they had dtype ``int64``. + Parameters ---------- data : array-like (1-dimensional)