@@ -4569,25 +4569,25 @@ def f():
4569
4569
df = DataFrame ({'a' : Categorical (idx )})
4570
4570
tm .assert_frame_equal (df .fillna (value = NaT ), df )
4571
4571
4572
- @pytest .mark .parametrize ('fill_value expected_output' , [
4572
+ @pytest .mark .parametrize ('fill_value, expected_output' , [
4573
4573
('a' , ['a' , 'a' , 'b' , 'a' , 'a' ]),
4574
4574
({1 : 'a' , 3 : 'b' , 4 : 'b' }, ['a' , 'a' , 'b' , 'b' , 'b' ]),
4575
4575
({1 : 'a' }, ['a' , 'a' , 'b' , np .nan , np .nan ]),
4576
4576
({1 : 'a' , 3 : 'b' }, ['a' , 'a' , 'b' , 'b' , np .nan ]),
4577
4577
(pd .Series ('a' ), ['a' , np .nan , 'b' , np .nan , np .nan ]),
4578
4578
(pd .Series ('a' , index = [1 ]), ['a' , 'a' , 'b' , np .nan , np .nan ]),
4579
4579
(pd .Series ({1 : 'a' , 3 : 'b' }), ['a' , 'a' , 'b' , 'b' , np .nan ]),
4580
- (pd .Series (['a' , 'b' ], index = [3 , 4 ]))
4580
+ (pd .Series (['a' , 'b' ], index = [3 , 4 ]), [ 'a' , np . nan , 'b' , 'a' , 'b' ] )
4581
4581
])
4582
- def fillna_series_categorical (self , fill_value , expected_output ):
4582
+ def test_fillna_series_categorical (self , fill_value , expected_output ):
4583
4583
# GH 17033
4584
4584
# Test fillna for a Categorical series
4585
4585
data = ['a' , np .nan , 'b' , np .nan , np .nan ]
4586
4586
s = pd .Series (pd .Categorical (data , categories = ['a' , 'b' ]))
4587
4587
exp = pd .Series (pd .Categorical (expected_output , categories = ['a' , 'b' ]))
4588
4588
tm .assert_series_equal (s .fillna (fill_value ), exp )
4589
4589
4590
- def fillna_series_categorical_errormsg (self ):
4590
+ def test_fillna_series_categorical_errormsg (self ):
4591
4591
data = ['a' , np .nan , 'b' , np .nan , np .nan ]
4592
4592
s = pd .Series (pd .Categorical (data , categories = ['a' , 'b' ]))
4593
4593
@@ -4605,7 +4605,7 @@ def fillna_series_categorical_errormsg(self):
4605
4605
4606
4606
with tm .assert_raises_regex (TypeError ,
4607
4607
'"value" parameter must be a scalar or '
4608
- 'dict but you passed a "list"' ):
4608
+ 'dict, but you passed a "list"' ):
4609
4609
s .fillna (['a' , 'b' ])
4610
4610
4611
4611
def test_astype_to_other (self ):
@@ -4941,3 +4941,4 @@ def test_map(self):
4941
4941
assert isinstance (res , tm .SubclassedCategorical )
4942
4942
exp = Categorical (['A' , 'B' , 'C' ])
4943
4943
tm .assert_categorical_equal (res , exp )
4944
+
0 commit comments