Skip to content

Add asv benchmarks for Block.setitem() #53177

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 8 commits into from
May 15, 2023
24 changes: 24 additions & 0 deletions asv_bench/benchmarks/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,28 @@ def time_chained_indexing(self, mode):
df2["C"] = 1.0


from datetime import datetime


class Block:
params = [
(True, "True"),
(np.array(True), "np.array(True)"),
]

def setup(self, true_value, mode):
self.df = DataFrame(
False,
columns=np.arange(500).astype(str),
index=date_range("2010-01-01", "2011-01-01"),
)

self.true_value = true_value

def time_test(self, true_value, mode):
start = datetime(2010, 5, 1)
end = datetime(2010, 9, 1)
self.df.loc[start:end, :] = true_value


from .pandas_vb_common import setup # noqa: F401 isort:skip