Skip to content

BUG: Bug in the returned Series.dt.components index was reset to the default index (GH9247) #9248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2015
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
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.16.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Bug Fixes
- Fixed issue using `read_csv` on s3 with Python 3.
- Fixed compatibility issue in ``DatetimeIndex`` affecting architectures where ``numpy.int_`` defaults to ``numpy.int32`` (:issue:`8943`)
- Bug in Panel indexing with an object-like (:issue:`9140`)

- Bug in the returned ``Series.dt.components`` index was reset to the default index (:issue:`9247`)



Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def compare(s, name):
tm.assert_series_equal(result, expected)

# timedeltaindex
for s in [Series(timedelta_range('1 day',periods=5)),
for s in [Series(timedelta_range('1 day',periods=5),index=list('abcde')),
Series(timedelta_range('1 day 01:23:45',periods=5,freq='s')),
Series(timedelta_range('2 days 01:23:45.012345',periods=5,freq='ms'))]:
for prop in ok_for_td:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tseries/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def to_pytimedelta(self):

@property
def components(self):
return self.values.components
return self.values.components.set_index(self.index)

TimedeltaProperties._add_delegate_accessors(delegate=TimedeltaIndex,
accessors=TimedeltaIndex._datetimelike_ops,
Expand Down