@@ -1101,6 +1101,7 @@ def test_consistency_for_boxed(self, box, int_frame_const_col):
1101
1101
1102
1102
class TestDataFrameAggregate :
1103
1103
def test_agg_transform (self , axis , float_frame ):
1104
+ float_frame = float_frame .head ()
1104
1105
other_axis = 1 if axis in {0 , "index" } else 0
1105
1106
1106
1107
with np .errstate (all = "ignore" ):
@@ -1124,11 +1125,16 @@ def test_agg_transform(self, axis, float_frame):
1124
1125
expected .index = pd .MultiIndex .from_product (
1125
1126
[float_frame .index , ["sqrt" ]]
1126
1127
)
1128
+ print ("result" )
1129
+ print (result )
1130
+ print ("expected" )
1131
+ print (expected )
1127
1132
tm .assert_frame_equal (result , expected )
1128
1133
1129
1134
# multiple items in list
1130
1135
# these are in the order as if we are applying both
1131
1136
# functions per series and then concatting
1137
+ print ("marker" )
1132
1138
result = float_frame .apply ([np .abs , np .sqrt ], axis = axis )
1133
1139
expected = zip_frames ([f_abs , f_sqrt ], axis = other_axis )
1134
1140
if axis in {0 , "index" }:
@@ -1139,20 +1145,24 @@ def test_agg_transform(self, axis, float_frame):
1139
1145
expected .index = pd .MultiIndex .from_product (
1140
1146
[float_frame .index , ["absolute" , "sqrt" ]]
1141
1147
)
1148
+ print ()
1149
+ print (result )
1150
+ print ()
1151
+ print (expected )
1142
1152
tm .assert_frame_equal (result , expected )
1143
1153
1144
1154
def test_transform_and_agg_err (self , axis , float_frame ):
1145
1155
# cannot both transform and agg
1146
1156
msg = "cannot combine transform and aggregation operations"
1147
1157
with pytest .raises (ValueError , match = msg ):
1148
1158
with np .errstate (all = "ignore" ):
1149
- float_frame .agg (["max" , "sqrt" ], axis = axis )
1159
+ print ( float_frame .agg (["max" , "sqrt" ], axis = axis ) )
1150
1160
1151
1161
df = DataFrame ({"A" : range (5 ), "B" : 5 })
1152
1162
1153
1163
def f ():
1154
1164
with np .errstate (all = "ignore" ):
1155
- df .agg ({"A" : ["abs" , "sum" ], "B" : ["mean" , "max" ]}, axis = axis )
1165
+ print ( df .agg ({"A" : ["abs" , "sum" ], "B" : ["mean" , "max" ]}, axis = axis ) )
1156
1166
1157
1167
def test_demo (self ):
1158
1168
# demonstration tests
0 commit comments