MCPcopy Create free account
hub / github.com/apache/arrow / test_hash_agg_basic

Function test_hash_agg_basic

python/pyarrow/tests/test_udf.py:804–819  ·  view source on GitHub ↗
(unary_agg_func_fixture)

Source from the content-addressed store, hash-verified

802
803@pytest.mark.numpy
804def test_hash_agg_basic(unary_agg_func_fixture):
805 arr1 = pa.array([10.0, 20.0, 30.0, 40.0, 50.0], pa.float64())
806 arr2 = pa.array([4, 2, 1, 2, 1], pa.int32())
807
808 arr3 = pa.array([60.0, 70.0, 80.0, 90.0, 100.0], pa.float64())
809 arr4 = pa.array([5, 1, 1, 4, 1], pa.int32())
810
811 table1 = pa.table([arr2, arr1], names=["id", "value"])
812 table2 = pa.table([arr4, arr3], names=["id", "value"])
813 table = pa.concat_tables([table1, table2])
814
815 result = table.group_by("id").aggregate([("value", "mean_udf")])
816 expected = table.group_by("id").aggregate(
817 [("value", "mean")]).rename_columns(['id', 'value_mean_udf'])
818
819 assert result.sort_by('id') == expected.sort_by('id')
820
821
822@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

aggregateMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected