File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ class Operation(Enum):
189
189
NUNIQUE = "nunique"
190
190
SUM = "sum"
191
191
MEAN = "mean"
192
+ MEDIAN = "median"
192
193
MIN = "min"
193
194
MAX = "max"
194
195
FIRST = "first"
@@ -197,7 +198,7 @@ def needs_column(self):
197
198
return self != self .SIZE
198
199
199
200
def needs_numeric_column (self ):
200
- return self in {self .SUM , self .MEAN }
201
+ return self in {self .SUM , self .MEAN , self . MEDIAN }
201
202
202
203
def default_outname (self , colname ):
203
204
if self == self .SIZE :
@@ -207,6 +208,7 @@ def default_outname(self, colname):
207
208
self .NUNIQUE : "Unique count" ,
208
209
self .SUM : "Sum" ,
209
210
self .MEAN : "Average" ,
211
+ self .MEDIAN : "Median" ,
210
212
self .MIN : "Minimum" ,
211
213
self .MAX : "Maximum" ,
212
214
self .FIRST : "First" ,
Original file line number Diff line number Diff line change @@ -318,6 +318,7 @@ def test_aggregate_numbers(self):
318
318
Aggregation (Operation .NUNIQUE , "B" , "nunique" ),
319
319
Aggregation (Operation .SUM , "B" , "sum" ),
320
320
Aggregation (Operation .MEAN , "B" , "mean" ),
321
+ Aggregation (Operation .MEDIAN , "B" , "median" ),
321
322
Aggregation (Operation .MIN , "B" , "min" ),
322
323
Aggregation (Operation .MAX , "B" , "max" ),
323
324
Aggregation (Operation .FIRST , "B" , "first" ),
@@ -332,6 +333,7 @@ def test_aggregate_numbers(self):
332
333
"nunique" : [1 , 2 ],
333
334
"sum" : [2 , 7 ],
334
335
"mean" : [2 , 7 / 3 ],
336
+ "median" : [2 , 1 ],
335
337
"min" : [2 , 1 ],
336
338
"max" : [2 , 5 ],
337
339
"first" : [2 , 1 ],
You can’t perform that action at this time.
0 commit comments