Skip to content

ASV: add FrameMixedDtypesOps #55939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions asv_bench/benchmarks/stat_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,39 @@ def time_op(self, op, dtype, axis):
self.df_func(axis=axis)


class FrameMixedDtypesOps:
params = [ops, [0, 1, None]]
param_names = ["op", "axis"]

def setup(self, op, axis):
if op in ("sum", "skew", "kurt", "prod", "sem", "var") or (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put this if statement before N and df are created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved.
ci on arm failed on test_dti_constructor_with_non_nano_now_today. seems like a flaky test tho

(op, axis)
in (
("mean", 1),
("mean", None),
("median", 1),
("median", None),
("std", 1),
)
):
# Skipping cases where datetime aggregations are not implemented
raise NotImplementedError

N = 1_000_000
df = pd.DataFrame(
{
"f": np.random.normal(0.0, 1.0, N),
"i": np.random.randint(0, N, N),
"ts": pd.date_range(start="1/1/2000", periods=N, freq="h"),
}
)

self.df_func = getattr(df, op)

def time_op(self, op, axis):
self.df_func(axis=axis)


class FrameMultiIndexOps:
params = [ops]
param_names = ["op"]
Expand Down