@@ -786,6 +786,19 @@ def kurt(x):
786
786
except ImportError :
787
787
pass
788
788
789
+ # TODO: Ensure warning isn't emitted in the first place
790
+ @pytest .mark .filterwarnings ("ignore:All-NaN:RuntimeWarning" )
791
+ def test_median (self , float_frame_with_na , int_frame ):
792
+ def wrapper (x ):
793
+ if isna (x ).any ():
794
+ return np .nan
795
+ return np .median (x )
796
+
797
+ assert_stat_op_calc ('median' , wrapper , float_frame_with_na ,
798
+ check_dates = True )
799
+ assert_stat_op_calc ('median' , wrapper , int_frame , check_dtype = False ,
800
+ check_dates = True )
801
+
789
802
@pytest .mark .parametrize ('method' , ['sum' , 'mean' , 'prod' , 'var' ,
790
803
'std' , 'skew' , 'min' , 'max' ])
791
804
def test_stat_operators_attempt_obj_array (self , method ):
@@ -868,42 +881,6 @@ def test_mean_excludeds_datetimes(self, tz):
868
881
expected = pd .Series ()
869
882
tm .assert_series_equal (result , expected )
870
883
871
- # TODO: Ensure warning isn't emitted in the first place
872
- @pytest .mark .filterwarnings ("ignore:All-NaN:RuntimeWarning" )
873
- def test_median (self , float_frame_with_na ):
874
- def wrapper (x ):
875
- if isna (x ).any ():
876
- return np .nan
877
- return np .median (x )
878
-
879
- assert_stat_op_calc ('median' , wrapper , float_frame_with_na ,
880
- check_dates = True )
881
-
882
- # TODO: Ensure warning isn't emitted in the first place
883
- @pytest .mark .filterwarnings ("ignore:All-NaN:RuntimeWarning" )
884
- def test_median_corner (self , int_frame ):
885
- def wrapper (x ):
886
- if isna (x ).any ():
887
- return np .nan
888
- return np .median (x )
889
-
890
- assert_stat_op_calc ('median' , wrapper , int_frame , check_dtype = False ,
891
- check_dates = True )
892
-
893
- def test_min (self , float_frame_with_na , int_frame ):
894
- with warnings .catch_warnings (record = True ):
895
- warnings .simplefilter ("ignore" , RuntimeWarning )
896
- assert_stat_op_calc ('min' , np .min , float_frame_with_na ,
897
- check_dates = True )
898
- assert_stat_op_calc ('min' , np .min , int_frame )
899
-
900
- def test_max (self , float_frame_with_na , int_frame ):
901
- with warnings .catch_warnings (record = True ):
902
- warnings .simplefilter ("ignore" , RuntimeWarning )
903
- assert_stat_op_calc ('max' , np .max , float_frame_with_na ,
904
- check_dates = True )
905
- assert_stat_op_calc ('max' , np .max , int_frame )
906
-
907
884
def test_var_std (self , datetime_frame ):
908
885
result = datetime_frame .std (ddof = 4 )
909
886
expected = datetime_frame .apply (lambda x : x .std (ddof = 4 ))
0 commit comments