Skip to content

BUG: GH12050 Setting values on Series using .loc with a TZ-aware DatetimeIndex fails #12054

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

Closed
wants to merge 1 commit into from

Conversation

coroa
Copy link
Contributor

@coroa coroa commented Jan 15, 2016

Fixes #12050 .

Taking just the values of an index object looses the timezone information.

@coroa
Copy link
Contributor Author

coroa commented Jan 15, 2016

Fix has been derived from similar code in the method _getitem_iterable around line 980 of indexing.py .

Somebody with a better knowledge about the interplay of all the functions should comment before merging.

@jreback
Copy link
Contributor

jreback commented Jan 15, 2016

tests!

@coroa coroa force-pushed the master branch 2 times, most recently from 3012661 to 380ba35 Compare January 15, 2016 20:45
@coroa
Copy link
Contributor Author

coroa commented Jan 15, 2016

Is this one good enough? Or should I also test for variations?

@@ -3511,6 +3511,17 @@ def test_loc_setitem_datetime(self):
expected = DataFrame({'one' : [100.0, 200.0]},index=[dt1, dt2])
assert_frame_equal(df, expected)

def test_loc_setitem_datetimeindex(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add the full gamut here (get/setitem) and .loc get/set. also make a loop and test index, list-like, single indexer.
(these all work, but covering bases).

put these tests near these existing ones on https://github.com/pydata/pandas/blob/master/pandas/tests/test_indexing.py#L856

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Timezones Timezone data dtype labels Jan 15, 2016
@jreback jreback added this to the 0.18.0 milestone Jan 15, 2016
@jreback
Copy link
Contributor

jreback commented Jan 15, 2016

pls also add a release note (bug fixes)

@coroa
Copy link
Contributor Author

coroa commented Jan 18, 2016

  • Fixed the tests.
  • Added release notes.
  • Rebased onto current master.
  • Squashed

Ready for merging from where i sit.

@jreback
Copy link
Contributor

jreback commented Jan 19, 2016

merged via 4182105

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants