@@ -135,19 +135,19 @@ def test_custom_mapping(self):
135135 custom_mapping = [
136136 {
137137 "col" : "col1" ,
138- "mapping" : {np .NaN : 0 , "a" : 1 , "b" : 2 },
138+ "mapping" : {np .nan : 0 , "a" : 1 , "b" : 2 },
139139 }, # The mapping from the documentation
140- {"col" : "col2" , "mapping" : {np .NaN : - 3 , "x" : 11 , "y" : 2 }},
140+ {"col" : "col2" , "mapping" : {np .nan : - 3 , "x" : 11 , "y" : 2 }},
141141 ]
142142 custom_mapping_series = [
143143 {
144144 "col" : "col1" ,
145- "mapping" : pd .Series ({np .NaN : 0 , "a" : 1 , "b" : 2 }),
145+ "mapping" : pd .Series ({np .nan : 0 , "a" : 1 , "b" : 2 }),
146146 }, # The mapping from the documentation
147- {"col" : "col2" , "mapping" : pd .Series ({np .NaN : - 3 , "x" : 11 , "y" : 2 })},
147+ {"col" : "col2" , "mapping" : pd .Series ({np .nan : - 3 , "x" : 11 , "y" : 2 })},
148148 ]
149149
150- train = pd .DataFrame ({"col1" : ["a" , "a" , "b" , np .NaN ], "col2" : ["x" , "y" , np .NaN , np .NaN ]})
150+ train = pd .DataFrame ({"col1" : ["a" , "a" , "b" , np .nan ], "col2" : ["x" , "y" , np .nan , np .nan ]})
151151
152152 for mapping in [custom_mapping , custom_mapping_series ]:
153153 with self .subTest ():
@@ -168,7 +168,7 @@ def test_HaveNegativeOneInTrain_ExpectCodedAsOne(self):
168168
169169 self .assertEqual (expected , result )
170170
171- def test_HaveNaNInTrain_ExpectCodedAsOne (self ):
171+ def test_HavenanInTrain_ExpectCodedAsOne (self ):
172172 train = pd .DataFrame ({"city" : [np .nan ]})
173173 expected = [1 ]
174174
@@ -362,16 +362,16 @@ def test_validate_mapping(self):
362362 custom_mapping = [
363363 {
364364 "col" : "col1" ,
365- "mapping" : {np .NaN : 0 , "a" : 1 , "b" : 2 },
365+ "mapping" : {np .nan : 0 , "a" : 1 , "b" : 2 },
366366 }, # The mapping from the documentation
367- {"col" : "col2" , "mapping" : {np .NaN : - 3 , "x" : 11 , "y" : 2 }},
367+ {"col" : "col2" , "mapping" : {np .nan : - 3 , "x" : 11 , "y" : 2 }},
368368 ]
369369 expected_valid_mapping = [
370370 {
371371 "col" : "col1" ,
372- "mapping" : pd .Series ({np .NaN : 0 , "a" : 1 , "b" : 2 }),
372+ "mapping" : pd .Series ({np .nan : 0 , "a" : 1 , "b" : 2 }),
373373 }, # The mapping from the documentation
374- {"col" : "col2" , "mapping" : pd .Series ({np .NaN : - 3 , "x" : 11 , "y" : 2 })},
374+ {"col" : "col2" , "mapping" : pd .Series ({np .nan : - 3 , "x" : 11 , "y" : 2 })},
375375 ]
376376 enc = encoders .OrdinalEncoder ()
377377 actual_valid_mapping = enc ._validate_supplied_mapping (custom_mapping )
0 commit comments