@@ -692,25 +692,27 @@ def test_groupby_multiindex_level_empty(self):
692
692
tm .assert_frame_equal (result , expected )
693
693
694
694
def test_default_observed_deprecated (self ):
695
- df = pd .DataFrame ([
696
- ['A' , 1 , 1 ], ['A' , 2 , 1 ], ['B' , 1 , 1 ]
697
- ], columns = [ 'x' , 'y' , 'z' ] )
698
- df .x = df .x .astype (' category' )
699
- df .y = df .x .astype (' category' )
695
+ df = pd .DataFrame (
696
+ [[ "A" , 1 , 1 ], ["A" , 2 , 1 ], ["B" , 1 , 1 ]], columns = [ "x" , "y" , "z" ]
697
+ )
698
+ df .x = df .x .astype (" category" )
699
+ df .y = df .x .astype (" category" )
700
700
701
- with tm .assert_produces_warning (expected_warning = FutureWarning ,
702
- check_stacklevel = False ):
703
- df .groupby (['x' , 'y' ])
701
+ with tm .assert_produces_warning (
702
+ expected_warning = FutureWarning , check_stacklevel = False
703
+ ):
704
+ df .groupby (["x" , "y" ])
704
705
705
706
with pytest .warns (None ) as any_warnings :
706
- df .groupby (['x' , 'y' ], observed = True )
707
- df .groupby (['x' , 'y' ], observed = False )
707
+ df .groupby (["x" , "y" ], observed = True )
708
+ df .groupby (["x" , "y" ], observed = False )
708
709
assert len (any_warnings ) == 0
709
710
710
- cat = pd .Categorical (['A' , 'B' , 'C' ], categories = ['A' , 'B' , 'C' , 'D' ])
711
+ cat = pd .Categorical (["A" , "B" , "C" ], categories = ["A" , "B" , "C" , "D" ])
711
712
s = Series (cat )
712
- with tm .assert_produces_warning (expected_warning = FutureWarning ,
713
- check_stacklevel = False ):
713
+ with tm .assert_produces_warning (
714
+ expected_warning = FutureWarning , check_stacklevel = False
715
+ ):
714
716
s .groupby (cat )
715
717
716
718
0 commit comments