File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,37 @@ def f():
63
63
df .loc [df .new_col == 'new' , 'time' ] = v
64
64
tm .assert_series_equal (df .loc [df .new_col == 'new' , 'time' ], v )
65
65
66
+ def test_consistency_with_tz_aware_scalar (self ):
67
+ # xef gh-12938
68
+ # various ways of indexing the same tz-aware scalar
69
+ df = Series ([Timestamp ('2016-03-30 14:35:25' ,
70
+ tz = 'Europe/Brussels' )]).to_frame ()
71
+
72
+ df = pd .concat ([df , df ]).reset_index (drop = True )
73
+ expected = Timestamp ('2016-03-30 14:35:25+0200' ,
74
+ tz = 'Europe/Brussels' )
75
+
76
+ result = df [0 ][0 ]
77
+ assert result == expected
78
+
79
+ result = df .iloc [0 , 0 ]
80
+ assert result == expected
81
+
82
+ result = df .loc [0 , 0 ]
83
+ assert result == expected
84
+
85
+ result = df .iat [0 , 0 ]
86
+ assert result == expected
87
+
88
+ result = df .at [0 , 0 ]
89
+ assert result == expected
90
+
91
+ result = df [0 ].loc [0 ]
92
+ assert result == expected
93
+
94
+ result = df [0 ].at [0 ]
95
+ assert result == expected
96
+
66
97
def test_indexing_with_datetimeindex_tz (self ):
67
98
68
99
# GH 12050
You can’t perform that action at this time.
0 commit comments