2525import pandas .util ._test_decorators as td
2626
2727
28- def _check_stat_op (self , name , alternative , main_frame , float_frame ,
28+ def _check_stat_op (name , alternative , main_frame , float_frame ,
2929 float_string_frame , has_skipna = True ,
3030 has_numeric_only = False , check_dtype = True ,
3131 check_dates = False , check_less_precise = False ,
@@ -103,7 +103,7 @@ def wrapper(x):
103103 tm .assert_series_equal (r1 , expected )
104104
105105
106- def _check_bool_op (self , name , alternative , frame , float_string_frame ,
106+ def _check_bool_op (name , alternative , frame , float_string_frame ,
107107 has_skipna = True , has_bool_only = False ):
108108
109109 f = getattr (frame , name )
@@ -596,10 +596,10 @@ def test_reduce_mixed_frame(self):
596596
597597 def test_count (self , float_frame_with_na , float_frame , float_string_frame ):
598598 f = lambda s : notna (s ).sum ()
599- self . _check_stat_op ('count' , f , float_frame_with_na , float_frame ,
600- float_string_frame , has_skipna = False ,
601- has_numeric_only = True , check_dtype = False ,
602- check_dates = True )
599+ _check_stat_op ('count' , f , float_frame_with_na , float_frame ,
600+ float_string_frame , has_skipna = False ,
601+ has_numeric_only = True , check_dtype = False ,
602+ check_dates = True )
603603
604604 # corner case
605605 frame = DataFrame ()
@@ -628,9 +628,9 @@ def test_count(self, float_frame_with_na, float_frame, float_string_frame):
628628 def test_nunique (self , float_frame_with_na , float_frame ,
629629 float_string_frame ):
630630 f = lambda s : len (algorithms .unique1d (s .dropna ()))
631- self . _check_stat_op ('nunique' , f , float_frame_with_na ,
632- float_frame , float_string_frame , has_skipna = False ,
633- check_dtype = False , check_dates = True )
631+ _check_stat_op ('nunique' , f , float_frame_with_na ,
632+ float_frame , float_string_frame , has_skipna = False ,
633+ check_dtype = False , check_dates = True )
634634
635635 df = DataFrame ({'A' : [1 , 1 , 1 ],
636636 'B' : [1 , 2 , 3 ],
@@ -644,15 +644,15 @@ def test_nunique(self, float_frame_with_na, float_frame,
644644
645645 def test_sum (self , float_frame_with_na , mixed_float_frame ,
646646 float_frame , float_string_frame ):
647- self . _check_stat_op ('sum' , np .sum , float_frame_with_na , float_frame ,
648- float_string_frame , has_numeric_only = True ,
649- skipna_alternative = np .nansum )
647+ _check_stat_op ('sum' , np .sum , float_frame_with_na , float_frame ,
648+ float_string_frame , has_numeric_only = True ,
649+ skipna_alternative = np .nansum )
650650
651651 # mixed types (with upcasting happening)
652- self . _check_stat_op ('sum' , np .sum ,
653- mixed_float_frame .astype ('float32' ), float_frame ,
654- float_string_frame , has_numeric_only = True ,
655- check_dtype = False , check_less_precise = True )
652+ _check_stat_op ('sum' , np .sum ,
653+ mixed_float_frame .astype ('float32' ), float_frame ,
654+ float_string_frame , has_numeric_only = True ,
655+ check_dtype = False , check_less_precise = True )
656656
657657 @pytest .mark .parametrize ('method' , ['sum' , 'mean' , 'prod' , 'var' ,
658658 'std' , 'skew' , 'min' , 'max' ])
@@ -679,13 +679,13 @@ def test_stat_operators_attempt_obj_array(self, method):
679679 tm .assert_series_equal (result , expected )
680680
681681 def test_mean (self , float_frame_with_na , float_frame , float_string_frame ):
682- self . _check_stat_op ('mean' , np .mean , float_frame_with_na ,
683- float_frame , float_string_frame , check_dates = True )
682+ _check_stat_op ('mean' , np .mean , float_frame_with_na ,
683+ float_frame , float_string_frame , check_dates = True )
684684
685685 def test_product (self , float_frame_with_na , float_frame ,
686686 float_string_frame ):
687- self . _check_stat_op ('product' , np .prod , float_frame_with_na ,
688- float_frame , float_string_frame )
687+ _check_stat_op ('product' , np .prod , float_frame_with_na ,
688+ float_frame , float_string_frame )
689689
690690 # TODO: Ensure warning isn't emitted in the first place
691691 @pytest .mark .filterwarnings ("ignore:All-NaN:RuntimeWarning" )
@@ -696,18 +696,18 @@ def wrapper(x):
696696 return np .nan
697697 return np .median (x )
698698
699- self . _check_stat_op ('median' , wrapper , float_frame_with_na ,
700- float_frame , float_string_frame , check_dates = True )
699+ _check_stat_op ('median' , wrapper , float_frame_with_na ,
700+ float_frame , float_string_frame , check_dates = True )
701701
702702 def test_min (self , float_frame_with_na , int_frame ,
703703 float_frame , float_string_frame ):
704704 with warnings .catch_warnings (record = True ):
705705 warnings .simplefilter ("ignore" , RuntimeWarning )
706- self . _check_stat_op ('min' , np .min , float_frame_with_na ,
707- float_frame , float_string_frame ,
708- check_dates = True )
709- self . _check_stat_op ('min' , np .min , int_frame , float_frame ,
710- float_string_frame )
706+ _check_stat_op ('min' , np .min , float_frame_with_na ,
707+ float_frame , float_string_frame ,
708+ check_dates = True )
709+ _check_stat_op ('min' , np .min , int_frame , float_frame ,
710+ float_string_frame )
711711
712712 def test_cummin (self , datetime_frame ):
713713 datetime_frame .loc [5 :10 , 0 ] = nan
@@ -759,26 +759,26 @@ def test_max(self, float_frame_with_na, int_frame,
759759 float_frame , float_string_frame ):
760760 with warnings .catch_warnings (record = True ):
761761 warnings .simplefilter ("ignore" , RuntimeWarning )
762- self . _check_stat_op ('max' , np .max , float_frame_with_na ,
763- float_frame , float_string_frame ,
764- check_dates = True )
765- self . _check_stat_op ('max' , np .max , int_frame , float_frame ,
766- float_string_frame )
762+ _check_stat_op ('max' , np .max , float_frame_with_na ,
763+ float_frame , float_string_frame ,
764+ check_dates = True )
765+ _check_stat_op ('max' , np .max , int_frame , float_frame ,
766+ float_string_frame )
767767
768768 def test_mad (self , float_frame_with_na , float_frame , float_string_frame ):
769769 f = lambda x : np .abs (x - x .mean ()).mean ()
770- self . _check_stat_op ('mad' , f , float_frame_with_na , float_frame ,
771- float_string_frame )
770+ _check_stat_op ('mad' , f , float_frame_with_na , float_frame ,
771+ float_string_frame )
772772
773773 def test_var_std (self , float_frame_with_na , datetime_frame , float_frame ,
774774 float_string_frame ):
775775 alt = lambda x : np .var (x , ddof = 1 )
776- self . _check_stat_op ('var' , alt , float_frame_with_na , float_frame ,
777- float_string_frame )
776+ _check_stat_op ('var' , alt , float_frame_with_na , float_frame ,
777+ float_string_frame )
778778
779779 alt = lambda x : np .std (x , ddof = 1 )
780- self . _check_stat_op ('std' , alt , float_frame_with_na , float_frame ,
781- float_string_frame )
780+ _check_stat_op ('std' , alt , float_frame_with_na , float_frame ,
781+ float_string_frame )
782782
783783 result = datetime_frame .std (ddof = 4 )
784784 expected = datetime_frame .apply (lambda x : x .std (ddof = 4 ))
@@ -892,8 +892,8 @@ def test_cumprod(self, datetime_frame):
892892 def test_sem (self , float_frame_with_na , datetime_frame ,
893893 float_frame , float_string_frame ):
894894 alt = lambda x : np .std (x , ddof = 1 ) / np .sqrt (len (x ))
895- self . _check_stat_op ('sem' , alt , float_frame_with_na ,
896- float_frame , float_string_frame )
895+ _check_stat_op ('sem' , alt , float_frame_with_na ,
896+ float_frame , float_string_frame )
897897
898898 result = datetime_frame .sem (ddof = 4 )
899899 expected = datetime_frame .apply (
@@ -917,8 +917,8 @@ def alt(x):
917917 return np .nan
918918 return skew (x , bias = False )
919919
920- self . _check_stat_op ('skew' , alt , float_frame_with_na ,
921- float_frame , float_string_frame )
920+ _check_stat_op ('skew' , alt , float_frame_with_na ,
921+ float_frame , float_string_frame )
922922
923923 @td .skip_if_no_scipy
924924 def test_kurt (self , float_frame_with_na , float_frame , float_string_frame ):
@@ -929,8 +929,8 @@ def alt(x):
929929 return np .nan
930930 return kurtosis (x , bias = False )
931931
932- self . _check_stat_op ('kurt' , alt , float_frame_with_na ,
933- float_frame , float_string_frame )
932+ _check_stat_op ('kurt' , alt , float_frame_with_na ,
933+ float_frame , float_string_frame )
934934
935935 index = MultiIndex (levels = [['bar' ], ['one' , 'two' , 'three' ], [0 , 1 ]],
936936 labels = [[0 , 0 , 0 , 0 , 0 , 0 ],
@@ -1205,9 +1205,9 @@ def wrapper(x):
12051205 return np .nan
12061206 return np .median (x )
12071207
1208- self . _check_stat_op ('median' , wrapper , int_frame , float_frame ,
1209- float_string_frame , check_dtype = False ,
1210- check_dates = True )
1208+ _check_stat_op ('median' , wrapper , int_frame , float_frame ,
1209+ float_string_frame , check_dtype = False ,
1210+ check_dates = True )
12111211
12121212 # Miscellanea
12131213
@@ -1263,12 +1263,12 @@ def test_idxmax(self, float_frame, int_frame):
12631263 # Logical reductions
12641264
12651265 def test_any_all (self , bool_frame_with_na , float_string_frame ):
1266- self . _check_bool_op ('any' , np .any , bool_frame_with_na ,
1267- float_string_frame , has_skipna = True ,
1268- has_bool_only = True )
1269- self . _check_bool_op ('all' , np .all , bool_frame_with_na ,
1270- float_string_frame , has_skipna = True ,
1271- has_bool_only = True )
1266+ _check_bool_op ('any' , np .any , bool_frame_with_na ,
1267+ float_string_frame , has_skipna = True ,
1268+ has_bool_only = True )
1269+ _check_bool_op ('all' , np .all , bool_frame_with_na ,
1270+ float_string_frame , has_skipna = True ,
1271+ has_bool_only = True )
12721272
12731273 def test_any_all_extra (self ):
12741274 df = DataFrame ({
0 commit comments