@@ -613,6 +613,18 @@ def test_basic_getitem_with_labels(self):
613
613
expected = s .reindex (arr_inds )
614
614
assert_series_equal (result , expected )
615
615
616
+ # GH12089
617
+ # with tz for values
618
+ s = Series (pd .date_range ("2011-01-01" , periods = 3 , tz = "US/Eastern" ),
619
+ index = ['a' , 'b' , 'c' ])
620
+ expected = Timestamp ('2011-01-01' , tz = 'US/Eastern' )
621
+ result = s .loc ['a' ]
622
+ self .assertEqual (result , expected )
623
+ result = s .iloc [0 ]
624
+ self .assertEqual (result , expected )
625
+ result = s ['a' ]
626
+ self .assertEqual (result , expected )
627
+
616
628
def test_basic_setitem_with_labels (self ):
617
629
indices = self .ts .index [[5 , 10 , 15 ]]
618
630
@@ -650,6 +662,26 @@ def test_basic_setitem_with_labels(self):
650
662
self .assertRaises (Exception , s .__setitem__ , inds_notfound , 0 )
651
663
self .assertRaises (Exception , s .__setitem__ , arr_inds_notfound , 0 )
652
664
665
+ # GH12089
666
+ # with tz for values
667
+ s = Series (pd .date_range ("2011-01-01" , periods = 3 , tz = "US/Eastern" ),
668
+ index = ['a' , 'b' , 'c' ])
669
+ s2 = s .copy ()
670
+ expected = Timestamp ('2011-01-03' , tz = 'US/Eastern' )
671
+ s2 .loc ['a' ] = expected
672
+ result = s2 .loc ['a' ]
673
+ self .assertEqual (result , expected )
674
+
675
+ s2 = s .copy ()
676
+ s2 .iloc [0 ] = expected
677
+ result = s2 .iloc [0 ]
678
+ self .assertEqual (result , expected )
679
+
680
+ s2 = s .copy ()
681
+ s2 ['a' ] = expected
682
+ result = s2 ['a' ]
683
+ self .assertEqual (result , expected )
684
+
653
685
def test_ix_getitem (self ):
654
686
inds = self .series .index [[3 , 4 , 7 ]]
655
687
assert_series_equal (self .series .ix [inds ], self .series .reindex (inds ))
0 commit comments