Skip to content

Commit 1a2dcc8

Browse files
steliospetrakis02im-vinicius
authored and
im-vinicius
committed
Add asv benchmarks for Block.setitem() (pandas-dev#53177)
* Add test for groupby with TimeGrouper * add asv_bench for block * add asv_bench for block * Delete block.py , move class Block to indexing.py , as requested and delete df.copy * Add one more parameter to signarures seems to solve the issue * change name to mode * Move import to the start of the file
1 parent e0c23cd commit 1a2dcc8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

asv_bench/benchmarks/indexing.py

+22
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
lower-level methods directly on Index and subclasses, see index_object.py,
44
indexing_engine.py, and index_cached.py
55
"""
6+
from datetime import datetime
67
import warnings
78

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

533534

535+
class Block:
536+
params = [
537+
(True, "True"),
538+
(np.array(True), "np.array(True)"),
539+
]
540+
541+
def setup(self, true_value, mode):
542+
self.df = DataFrame(
543+
False,
544+
columns=np.arange(500).astype(str),
545+
index=date_range("2010-01-01", "2011-01-01"),
546+
)
547+
548+
self.true_value = true_value
549+
550+
def time_test(self, true_value, mode):
551+
start = datetime(2010, 5, 1)
552+
end = datetime(2010, 9, 1)
553+
self.df.loc[start:end, :] = true_value
554+
555+
534556
from .pandas_vb_common import setup # noqa: F401 isort:skip

0 commit comments

Comments
 (0)