File tree 3 files changed +17
-7
lines changed
3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -2158,6 +2158,16 @@ def iget(self, key):
2158
2158
result = Timedelta (result )
2159
2159
return result
2160
2160
2161
+ def iget (self , key ):
2162
+ # GH#31649 we need to wrap scalars in Timestamp/Timedelta
2163
+ # TODO: this can be removed if we ever have 2D EA
2164
+ result = super ().iget (key )
2165
+ if isinstance (result , np .datetime64 ):
2166
+ result = Timestamp (result )
2167
+ elif isinstance (result , np .timedelta64 ):
2168
+ result = Timedelta (result )
2169
+ return result
2170
+
2161
2171
2162
2172
class DatetimeBlock (DatetimeLikeBlockMixin , Block ):
2163
2173
__slots__ = ()
Original file line number Diff line number Diff line change @@ -2270,13 +2270,6 @@ def test_set_reset(self):
2270
2270
df = result .set_index ("foo" )
2271
2271
tm .assert_index_equal (df .index , idx )
2272
2272
2273
- def test_transpose (self , uint64_frame ):
2274
-
2275
- result = uint64_frame .T
2276
- expected = DataFrame (uint64_frame .values .T )
2277
- expected .index = ["A" , "B" ]
2278
- tm .assert_frame_equal (result , expected )
2279
-
2280
2273
2281
2274
def test_object_casting_indexing_wraps_datetimelike ():
2282
2275
# GH#31649, check the indexing methods all the way down the stack
Original file line number Diff line number Diff line change @@ -41,3 +41,10 @@ def test_transpose_object_to_tzaware_mixed_tz(self):
41
41
assert (df2 .dtypes == object ).all ()
42
42
res2 = df2 .T
43
43
assert (res2 .dtypes == [dti .dtype , dti2 .dtype ]).all ()
44
+
45
+ def test_transpose_uint64 (self , uint64_frame ):
46
+
47
+ result = uint64_frame .T
48
+ expected = DataFrame (uint64_frame .values .T )
49
+ expected .index = ["A" , "B" ]
50
+ tm .assert_frame_equal (result , expected )
You can’t perform that action at this time.
0 commit comments