def test_example_value_presence_null_array(self): t = pa.Table.from_arrays([ pa.array([None, None], type=pa.null()), ], ['x']) self.assertIsNone( lift_stats_generator._get_example_value_presence( t, types.FeaturePath(['x']), boundaries=None))
def test_example_value_presence_struct_leaf(self): t = pa.Table.from_arrays([ pa.array([[ { 'y': [1] }, { 'y': [1, 2] }, { 'y': [3] }, ], [ { 'y': [1, 4] }, ]]) ], ['x']) expected_series = pd.Series([1, 2, 3, 1, 4], name='values', index=pd.Index([0, 0, 0, 1, 1], name='example_indices')) pd.testing.assert_series_equal( expected_series, lift_stats_generator._get_example_value_presence(t, types.FeaturePath( ['x', 'y']), boundaries=None))
def test_example_value_presence_none_value(self): t = pa.Table.from_arrays([ pa.array([[1], None]), ], ['x']) expected_series = pd.Series([1], name='values', index=pd.Index([0], name='example_indices')) pd.testing.assert_series_equal( expected_series, lift_stats_generator._get_example_value_presence( t, types.FeaturePath(['x']), boundaries=None))