ENH: add masked algorithm for mean() function by Akshatt · Pull Request #34814 · pandas-dev/pandas (original) (raw)
This operation is already covered by
class NanOps: |
---|
params = [ |
[ |
"var", |
"mean", |
"median", |
"max", |
"min", |
"sum", |
"std", |
"sem", |
"argmax", |
"skew", |
"kurt", |
"prod", |
], |
[10 ** 3, 10 ** 6], |
["int8", "int32", "int64", "float64", "Int64", "boolean"], |
] |
param_names = ["func", "N", "dtype"] |
def setup(self, func, N, dtype): |
if func == "argmax" and dtype in {"Int64", "boolean"}: |
# Skip argmax for nullable int since this doesn't work yet (GH-24382) |
raise NotImplementedError |
self.s = Series([1] * N, dtype=dtype) |
self.func = getattr(self.s, func) |
def time_func(self, func, N, dtype): |
self.func() |
(I added Int64 in general for all ops, so including mean, when I added a masked sum/prod algorithm)
So no need to write additional benchmarks I think.
For tests, it would be good to add it here:
def test_ops_consistency_on_empty(self, method): |
---|
(we mainly need to check the behaviour on empty)