Skip to content

Commit

Permalink
add asv
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Jun 27, 2019
1 parent 3a850af commit ab6cb31
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion asv_bench/benchmarks/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pandas import (Series, DataFrame, MultiIndex,
Int64Index, UInt64Index, Float64Index,
IntervalIndex, CategoricalIndex,
IndexSlice, concat, date_range)
IndexSlice, concat, date_range, option_context)


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


class ChainIndexing:

params = [None, 'warn']
param_names = ['mode']

def setup(self, mode):
self.N = 1000000

def time_chained_indexing(self, mode):
with warnings.catch_warnings(record=True):
with option_context('mode.chained_assignment', mode):
df = DataFrame({'A': np.arange(self.N), 'B': 'foo'})
df2 = df[df.A > self.N // 2]
df2['C'] = 1.0


from .pandas_vb_common import setup # noqa: F401

0 comments on commit ab6cb31

Please sign in to comment.