Skip to content

Commit ab6cb31

Browse files
committed
add asv
1 parent 3a850af commit ab6cb31

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

asv_bench/benchmarks/indexing.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pandas import (Series, DataFrame, MultiIndex,
66
Int64Index, UInt64Index, Float64Index,
77
IntervalIndex, CategoricalIndex,
8-
IndexSlice, concat, date_range)
8+
IndexSlice, concat, date_range, option_context)
99

1010

1111
class NumericSeriesIndexing:
@@ -335,4 +335,20 @@ def time_assign_with_setitem(self):
335335
self.df[i] = np.random.randn(self.N)
336336

337337

338+
class ChainIndexing:
339+
340+
params = [None, 'warn']
341+
param_names = ['mode']
342+
343+
def setup(self, mode):
344+
self.N = 1000000
345+
346+
def time_chained_indexing(self, mode):
347+
with warnings.catch_warnings(record=True):
348+
with option_context('mode.chained_assignment', mode):
349+
df = DataFrame({'A': np.arange(self.N), 'B': 'foo'})
350+
df2 = df[df.A > self.N // 2]
351+
df2['C'] = 1.0
352+
353+
338354
from .pandas_vb_common import setup # noqa: F401

0 commit comments

Comments
 (0)