Skip to content

Commit ffacd38

Browse files
doc fixes
1 parent 41728a9 commit ffacd38

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

doc/source/whatsnew/v0.20.0.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,16 @@ New Behavior:
472472
s.map(lambda x: x.hour)
473473

474474

475+
.. _whatsnew_0200.api_breaking.index_dt_field:
476+
475477
Accessing datetime fields of Index now return Index
476478
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
477479

478480
The several datetime-related attributes (see :ref:`here <timeseries.components>`
479-
for an overview) of DatetimeIndex, PeriodIndex and TimedeltaIndex previously
481+
for an overview) of ``DatetimeIndex``, ``PeriodIndex`` and ``TimedeltaIndex`` previously
480482
returned numpy arrays, now they will return a new Index object (:issue:`15022`).
481-
Only in case of a boolean field, still a boolean array is returned to support
482-
boolean indexing.
483+
Only in the case of a boolean field, a the return value is still a boolean array
484+
instead of an Index (to support boolean indexing).
483485

484486
Previous behaviour:
485487

pandas/tests/indexes/datetimes/test_misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_datetimeindex_accessors(self):
260260

261261
# non boolean accessors -> return Index
262262
for accessor in ['year', 'month', 'day', 'hour', 'minute',
263-
'second', 'microsecond', 'nanosecond',
263+
'second', 'microsecond', 'nanosecond',
264264
'dayofweek', 'dayofyear', 'weekofyear',
265265
'quarter', 'weekday_name']:
266266
res = getattr(dti, accessor)

0 commit comments

Comments
 (0)