@@ -579,25 +579,17 @@ def test_fillna_categorical(self, fill_value, expected_output):
579
579
tm .assert_series_equal (s .fillna (fill_value ), exp )
580
580
581
581
@pytest .mark .parametrize (
582
- "new_categories, fill_value, expected_output" ,
582
+ "fill_value, expected_output" ,
583
583
[
584
- (
585
- ["c" , "d" , "e" ],
586
- Series (["a" , "b" , "c" , "d" , "e" ]),
587
- ["a" , "b" , "b" , "d" , "e" ],
588
- )
584
+ (Series (["a" , "b" , "c" , "d" , "e" ]), ["a" , "b" , "b" , "d" , "e" ]),
585
+ (Series (["b" , "d" , "a" , "d" , "a" ]), ["a" , "d" , "b" , "d" , "a" ]),
589
586
],
590
587
)
591
- def test_fillna_categorical_with_new_categories (
592
- self , new_categories , fill_value , expected_output
593
- ):
588
+ def test_fillna_categorical_with_new_categories (self , fill_value , expected_output ):
594
589
# GH 26215
595
590
data = ["a" , np .nan , "b" , np .nan , np .nan ]
596
- s = Series (Categorical (data , categories = ["a" , "b" ]))
597
- s .cat .add_categories (new_categories , inplace = True )
598
- exp = Series (
599
- Categorical (expected_output , categories = ["a" , "b" ] + new_categories )
600
- )
591
+ s = Series (Categorical (data , categories = ["a" , "b" , "c" , "d" , "e" ]))
592
+ exp = Series (Categorical (expected_output , categories = ["a" , "b" , "c" , "d" , "e" ]))
601
593
tm .assert_series_equal (s .fillna (fill_value ), exp )
602
594
603
595
def test_fillna_categorical_raise (self ):
0 commit comments