Exemplo n.º 1
0
    def test_multiple_missing_value_replacement(self):
        """check neighbourhood average is correct when no neighbours contain 
		missing data."""
        missing_data = np.array([[3, 4, 5], [4, -999, -999], [2, -999, 5]])
        expected_data = np.array([[3, 4, 5], [4, 4, 5], [2, 3, 5]])
        data = replace_missing_values(missing_data)
        np.testing.assert_array_equal(expected_data, data)
Exemplo n.º 2
0
def handle_missing_data(data):
    ### Handle Missing Data
    for date in data.keys():
        missing_data_ratio = missing_ratio(data[date])        
        #Replace missing data with average of neighbours
        if missing_data_ratio:
            data[date] = replace_missing_values(data[date])
            
    return data
	def test_multiple_missing_value_replacement(self):
		"""check neighbourhood average is correct when no neighbours contain 
		missing data."""
		missing_data = np.array([[3,4,5],
						         [4,-999,-999],
						         [2,-999,5]])
		expected_data = np.array([[3,4,5],
					     		  [4,4,5],
					     		  [2,3,5]])
		data = replace_missing_values(missing_data)
		np.testing.assert_array_equal(expected_data, data)