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
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
22 changes: 22 additions & 0 deletions asv_bench/benchmarks/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
lower-level methods directly on Index and subclasses, see index_object.py,
indexing_engine.py, and index_cached.py
"""
from datetime import datetime
import warnings

import numpy as np
Expand Down Expand Up @@ -531,4 +532,25 @@ def time_chained_indexing(self, mode):
df2["C"] = 1.0


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