File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 55from 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
1111class 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+
338354from .pandas_vb_common import setup # noqa: F401
You can’t perform that action at this time.
0 commit comments