Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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*:

Expand Down
5 changes: 5 additions & 0 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down