Skip to content

Commit e69deae

Browse files
committed
Merge pull request pandas-dev#9248 from jreback/td
BUG: Bug in the returned Series.dt.components index was reset to the default index (GH9247)
2 parents 7ff744d + 193b467 commit e69deae

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

doc/source/whatsnew/v0.16.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Bug Fixes
8686
- Fixed issue using `read_csv` on s3 with Python 3.
8787
- Fixed compatibility issue in ``DatetimeIndex`` affecting architectures where ``numpy.int_`` defaults to ``numpy.int32`` (:issue:`8943`)
8888
- Bug in Panel indexing with an object-like (:issue:`9140`)
89-
89+
- Bug in the returned ``Series.dt.components`` index was reset to the default index (:issue:`9247`)
9090

9191

9292

pandas/tests/test_series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def compare(s, name):
142142
tm.assert_series_equal(result, expected)
143143

144144
# timedeltaindex
145-
for s in [Series(timedelta_range('1 day',periods=5)),
145+
for s in [Series(timedelta_range('1 day',periods=5),index=list('abcde')),
146146
Series(timedelta_range('1 day 01:23:45',periods=5,freq='s')),
147147
Series(timedelta_range('2 days 01:23:45.012345',periods=5,freq='ms'))]:
148148
for prop in ok_for_td:

pandas/tseries/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def to_pytimedelta(self):
139139

140140
@property
141141
def components(self):
142-
return self.values.components
142+
return self.values.components.set_index(self.index)
143143

144144
TimedeltaProperties._add_delegate_accessors(delegate=TimedeltaIndex,
145145
accessors=TimedeltaIndex._datetimelike_ops,

0 commit comments

Comments
 (0)