Skip to content

Commit 66b5235

Browse files
quangngdmroeschke
andauthored
ASV: add FrameMixedDtypesOps (#55939)
* asv FrameMixedDtypesOps * fix * Update asv_bench/benchmarks/stat_ops.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * Update asv_bench/benchmarks/stat_ops.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * minor --------- Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
1 parent 6e4f10b commit 66b5235

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

asv_bench/benchmarks/stat_ops.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,39 @@ def time_op(self, op, dtype, axis):
2020
self.df_func(axis=axis)
2121

2222

23+
class FrameMixedDtypesOps:
24+
params = [ops, [0, 1, None]]
25+
param_names = ["op", "axis"]
26+
27+
def setup(self, op, axis):
28+
if op in ("sum", "skew", "kurt", "prod", "sem", "var") or (
29+
(op, axis)
30+
in (
31+
("mean", 1),
32+
("mean", None),
33+
("median", 1),
34+
("median", None),
35+
("std", 1),
36+
)
37+
):
38+
# Skipping cases where datetime aggregations are not implemented
39+
raise NotImplementedError
40+
41+
N = 1_000_000
42+
df = pd.DataFrame(
43+
{
44+
"f": np.random.normal(0.0, 1.0, N),
45+
"i": np.random.randint(0, N, N),
46+
"ts": pd.date_range(start="1/1/2000", periods=N, freq="h"),
47+
}
48+
)
49+
50+
self.df_func = getattr(df, op)
51+
52+
def time_op(self, op, axis):
53+
self.df_func(axis=axis)
54+
55+
2356
class FrameMultiIndexOps:
2457
params = [ops]
2558
param_names = ["op"]

0 commit comments

Comments
 (0)