def test_histogram_to_array(self): data = pd.Series([], dtype=object) profiler = FloatColumn(data.name) profiler.update(data) profiler.histogram_methods['auto']['histogram']['bin_counts'] = \ np.array([3, 2, 1]) profiler.histogram_methods['auto']['histogram']['bin_edges'] = \ np.array([1.0, 3.0, 5.0, 7.0]) array_from_histogram = profiler._histogram_to_array('auto') expected_array = [1.0, 1.0, 1.0, 3.0, 3.0, 7.0] self.assertCountEqual(array_from_histogram, expected_array)
def test_histogram_to_array(self): data = pd.Series([], dtype=object) profiler = FloatColumn(data.name) profiler.update(data) profiler._stored_histogram['histogram']['bin_counts'] = \ np.array([3, 2, 1]) profiler._stored_histogram['histogram']['bin_edges'] = \ np.array([1.0, 3.0, 5.0, 7.0]) array_from_histogram = profiler._histogram_to_array() expected_array = [1.0, 1.0, 1.0, 3.0, 3.0, 7.0] self.assertEqual(expected_array, array_from_histogram.tolist())