1818 ],
1919 ids = ["string" , "interval" ],
2020)
21- def test_map_str (data , categories , ordered , na_action ):
21+ def test_map_str (data , categories , ordered , skipna ):
2222 # GH 31202 - override base class since we want to maintain categorical/ordered
2323 cat = Categorical (data , categories = categories , ordered = ordered )
24- result = cat .map (str , na_action = na_action )
24+ result = cat .map (str , skipna = skipna )
2525 expected = Categorical (
2626 map (str , data ), categories = map (str , categories ), ordered = ordered
2727 )
2828 tm .assert_categorical_equal (result , expected )
2929
3030
31- def test_map (na_action ):
31+ def test_map (skipna ):
3232 cat = Categorical (list ("ABABC" ), categories = list ("CBA" ), ordered = True )
33- result = cat .map (lambda x : x .lower (), na_action = na_action )
33+ result = cat .map (lambda x : x .lower (), skipna = skipna )
3434 exp = Categorical (list ("ababc" ), categories = list ("cba" ), ordered = True )
3535 tm .assert_categorical_equal (result , exp )
3636
3737 cat = Categorical (list ("ABABC" ), categories = list ("BAC" ), ordered = False )
38- result = cat .map (lambda x : x .lower (), na_action = na_action )
38+ result = cat .map (lambda x : x .lower (), skipna = skipna )
3939 exp = Categorical (list ("ababc" ), categories = list ("bac" ), ordered = False )
4040 tm .assert_categorical_equal (result , exp )
4141
4242 # GH 12766: Return an index not an array
43- result = cat .map (lambda x : 1 , na_action = na_action )
43+ result = cat .map (lambda x : 1 , skipna = skipna )
4444 exp = Index (np .array ([1 ] * 5 , dtype = np .int64 ))
4545 tm .assert_index_equal (result , exp )
4646
@@ -50,15 +50,15 @@ def test_map(na_action):
5050 def f (x ):
5151 return {"A" : 10 , "B" : 20 , "C" : 30 }.get (x )
5252
53- result = cat .map (f , na_action = na_action )
53+ result = cat .map (f , skipna = skipna )
5454 exp = Categorical ([10 , 20 , 10 , 20 , 30 ], categories = [20 , 10 , 30 ], ordered = False )
5555 tm .assert_categorical_equal (result , exp )
5656
5757 mapper = Series ([10 , 20 , 30 ], index = ["A" , "B" , "C" ])
58- result = cat .map (mapper , na_action = na_action )
58+ result = cat .map (mapper , skipna = skipna )
5959 tm .assert_categorical_equal (result , exp )
6060
61- result = cat .map ({"A" : 10 , "B" : 20 , "C" : 30 }, na_action = na_action )
61+ result = cat .map ({"A" : 10 , "B" : 20 , "C" : 30 }, skipna = skipna )
6262 tm .assert_categorical_equal (result , exp )
6363
6464
@@ -83,7 +83,7 @@ def f(x):
8383)
8484def test_map_with_nan_none (data , f , expected ): # GH 24241
8585 values = Categorical (data )
86- result = values .map (f , na_action = None )
86+ result = values .map (f , skipna = False )
8787 if isinstance (expected , Categorical ):
8888 tm .assert_categorical_equal (result , expected )
8989 else :
@@ -111,26 +111,26 @@ def test_map_with_nan_none(data, f, expected): # GH 24241
111111)
112112def test_map_with_nan_ignore (data , f , expected ): # GH 24241
113113 values = Categorical (data )
114- result = values .map (f , na_action = "ignore" )
114+ result = values .map (f , skipna = True )
115115 if data [1 ] == 1 :
116116 tm .assert_categorical_equal (result , expected )
117117 else :
118118 tm .assert_index_equal (result , expected )
119119
120120
121- def test_map_with_dict_or_series (na_action ):
121+ def test_map_with_dict_or_series (skipna ):
122122 orig_values = ["a" , "B" , 1 , "a" ]
123123 new_values = ["one" , 2 , 3.0 , "one" ]
124124 cat = Categorical (orig_values )
125125
126126 mapper = Series (new_values [:- 1 ], index = orig_values [:- 1 ])
127- result = cat .map (mapper , na_action = na_action )
127+ result = cat .map (mapper , skipna = skipna )
128128
129129 # Order of categories in result can be different
130130 expected = Categorical (new_values , categories = [3.0 , 2 , "one" ])
131131 tm .assert_categorical_equal (result , expected )
132132
133133 mapper = dict (zip (orig_values [:- 1 ], new_values [:- 1 ]))
134- result = cat .map (mapper , na_action = na_action )
134+ result = cat .map (mapper , skipna = skipna )
135135 # Order of categories in result can be different
136136 tm .assert_categorical_equal (result , expected )
0 commit comments