@@ -4601,25 +4601,25 @@ def f():
4601
4601
df = pd .DataFrame ({'a' : pd .Categorical (idx )})
4602
4602
tm .assert_frame_equal (df .fillna (value = pd .NaT ), df )
4603
4603
4604
- @pytest .mark .parametrize ('fill_value expected_output' , [
4604
+ @pytest .mark .parametrize ('fill_value, expected_output' , [
4605
4605
('a' , ['a' , 'a' , 'b' , 'a' , 'a' ]),
4606
4606
({1 : 'a' , 3 : 'b' , 4 : 'b' }, ['a' , 'a' , 'b' , 'b' , 'b' ]),
4607
4607
({1 : 'a' }, ['a' , 'a' , 'b' , np .nan , np .nan ]),
4608
4608
({1 : 'a' , 3 : 'b' }, ['a' , 'a' , 'b' , 'b' , np .nan ]),
4609
4609
(pd .Series ('a' ), ['a' , np .nan , 'b' , np .nan , np .nan ]),
4610
4610
(pd .Series ('a' , index = [1 ]), ['a' , 'a' , 'b' , np .nan , np .nan ]),
4611
4611
(pd .Series ({1 : 'a' , 3 : 'b' }), ['a' , 'a' , 'b' , 'b' , np .nan ]),
4612
- (pd .Series (['a' , 'b' ], index = [3 , 4 ]))
4612
+ (pd .Series (['a' , 'b' ], index = [3 , 4 ]), [ 'a' , np . nan , 'b' , 'a' , 'b' ] )
4613
4613
])
4614
- def fillna_series_categorical (self , fill_value , expected_output ):
4614
+ def test_fillna_series_categorical (self , fill_value , expected_output ):
4615
4615
# GH 17033
4616
4616
# Test fillna for a Categorical series
4617
4617
data = ['a' , np .nan , 'b' , np .nan , np .nan ]
4618
4618
s = pd .Series (pd .Categorical (data , categories = ['a' , 'b' ]))
4619
4619
exp = pd .Series (pd .Categorical (expected_output , categories = ['a' , 'b' ]))
4620
4620
tm .assert_series_equal (s .fillna (fill_value ), exp )
4621
4621
4622
- def fillna_series_categorical_errormsg (self ):
4622
+ def test_fillna_series_categorical_errormsg (self ):
4623
4623
data = ['a' , np .nan , 'b' , np .nan , np .nan ]
4624
4624
s = pd .Series (pd .Categorical (data , categories = ['a' , 'b' ]))
4625
4625
@@ -4637,7 +4637,7 @@ def fillna_series_categorical_errormsg(self):
4637
4637
4638
4638
with tm .assert_raises_regex (TypeError ,
4639
4639
'"value" parameter must be a scalar or '
4640
- 'dict but you passed a "list"' ):
4640
+ 'dict, but you passed a "list"' ):
4641
4641
s .fillna (['a' , 'b' ])
4642
4642
4643
4643
def test_astype_to_other (self ):
@@ -4973,3 +4973,4 @@ def test_map(self):
4973
4973
assert isinstance (res , tm .SubclassedCategorical )
4974
4974
exp = Categorical (['A' , 'B' , 'C' ])
4975
4975
tm .assert_categorical_equal (res , exp )
4976
+
0 commit comments