@@ -748,13 +748,13 @@ def test_frame_apply_dont_convert_datetime64():
748
748
749
749
def test_apply_non_numpy_dtype ():
750
750
# GH 12244
751
- df = DataFrame ({"dt" : pd . date_range ("2015-01-01" , periods = 3 , tz = "Europe/Brussels" )})
751
+ df = DataFrame ({"dt" : date_range ("2015-01-01" , periods = 3 , tz = "Europe/Brussels" )})
752
752
result = df .apply (lambda x : x )
753
753
tm .assert_frame_equal (result , df )
754
754
755
755
result = df .apply (lambda x : x + pd .Timedelta ("1day" ))
756
756
expected = DataFrame (
757
- {"dt" : pd . date_range ("2015-01-02" , periods = 3 , tz = "Europe/Brussels" )}
757
+ {"dt" : date_range ("2015-01-02" , periods = 3 , tz = "Europe/Brussels" )}
758
758
)
759
759
tm .assert_frame_equal (result , expected )
760
760
@@ -1149,11 +1149,9 @@ def test_agg_transform(axis, float_frame):
1149
1149
result = float_frame .apply ([np .sqrt ], axis = axis )
1150
1150
expected = f_sqrt .copy ()
1151
1151
if axis in {0 , "index" }:
1152
- expected .columns = pd .MultiIndex .from_product (
1153
- [float_frame .columns , ["sqrt" ]]
1154
- )
1152
+ expected .columns = MultiIndex .from_product ([float_frame .columns , ["sqrt" ]])
1155
1153
else :
1156
- expected .index = pd . MultiIndex .from_product ([float_frame .index , ["sqrt" ]])
1154
+ expected .index = MultiIndex .from_product ([float_frame .index , ["sqrt" ]])
1157
1155
tm .assert_frame_equal (result , expected )
1158
1156
1159
1157
# multiple items in list
@@ -1162,11 +1160,11 @@ def test_agg_transform(axis, float_frame):
1162
1160
result = float_frame .apply ([np .abs , np .sqrt ], axis = axis )
1163
1161
expected = zip_frames ([f_abs , f_sqrt ], axis = other_axis )
1164
1162
if axis in {0 , "index" }:
1165
- expected .columns = pd . MultiIndex .from_product (
1163
+ expected .columns = MultiIndex .from_product (
1166
1164
[float_frame .columns , ["absolute" , "sqrt" ]]
1167
1165
)
1168
1166
else :
1169
- expected .index = pd . MultiIndex .from_product (
1167
+ expected .index = MultiIndex .from_product (
1170
1168
[float_frame .index , ["absolute" , "sqrt" ]]
1171
1169
)
1172
1170
tm .assert_frame_equal (result , expected )
@@ -1228,7 +1226,7 @@ def test_agg_multiple_mixed_no_warning():
1228
1226
"A" : [1 , 2 , 3 ],
1229
1227
"B" : [1.0 , 2.0 , 3.0 ],
1230
1228
"C" : ["foo" , "bar" , "baz" ],
1231
- "D" : pd . date_range ("20130101" , periods = 3 ),
1229
+ "D" : date_range ("20130101" , periods = 3 ),
1232
1230
}
1233
1231
)
1234
1232
expected = DataFrame (
@@ -1343,7 +1341,7 @@ def test_nuiscance_columns():
1343
1341
"A" : [1 , 2 , 3 ],
1344
1342
"B" : [1.0 , 2.0 , 3.0 ],
1345
1343
"C" : ["foo" , "bar" , "baz" ],
1346
- "D" : pd . date_range ("20130101" , periods = 3 ),
1344
+ "D" : date_range ("20130101" , periods = 3 ),
1347
1345
}
1348
1346
)
1349
1347
0 commit comments