Example #1
0
 def test_multiple_features(self):
     sample = pd.DataFrame({'a': [-1,'?','inf'],
                            'b': ['null','none','Missing']})
     for col in sample:
         for i in range(len(sample[col])):
             val = list(support.placehold_to_nan(sample)[col])[i]
             self.assertEqual(math.isnan(val), True)
Example #2
0
 def test_nondefault_placeholds_and_no_placeholds(self):
     sample = pd.DataFrame({'a': [1, 2, 3, 4, 5]})
     self.assertEqual(list(support.placehold_to_nan(sample, [6])['a']), list(sample['a']))
Example #3
0
 def test_nondefault_placeholds(self):
     sample = pd.DataFrame({'a': [1, 2, 3, 4, 5]})
     self.assertEqual(math.isnan(list(support.placehold_to_nan(sample, [5])['a'])[4]), True)
Example #4
0
 def test_default_values(self):
     sample = pd.DataFrame({'a': [-999, -1, '?', 'inf']})
     for i in range(len(sample)):
         val = list(support.placehold_to_nan(sample)['a'])[i]
         self.assertEqual(math.isnan(val), True)
Example #5
0
 def test_empty_object(self):
     sample = pd.DataFrame()
     self.assertEqual(list(support.placehold_to_nan(sample)), [])