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

Function test_rank_normal_options

python/pyarrow/tests/test_compute.py:4055–4077  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4053
4054
4055def test_rank_normal_options():
4056 arr = pa.array([None, 1, None, 2, None])
4057
4058 expected = pytest.approx(
4059 [0.5244005127080407, -1.2815515655446004, 0.5244005127080407,
4060 -0.5244005127080409, 0.5244005127080407])
4061 result = pc.rank_normal(arr)
4062 assert result.to_pylist() == expected
4063 result = pc.rank_normal(arr, sort_keys=[("", "ascending", "at_end")])
4064 assert result.to_pylist() == expected
4065 result = pc.rank_normal(arr, options=pc.RankQuantileOptions())
4066 assert result.to_pylist() == expected
4067
4068 expected = pytest.approx(
4069 [-0.5244005127080409, 1.2815515655446004, -0.5244005127080409,
4070 0.5244005127080407, -0.5244005127080409])
4071 result = pc.rank_normal(arr, sort_keys=[("", "descending", "at_start")])
4072 assert result.to_pylist() == expected
4073 result = pc.rank_normal(arr,
4074 options=pc.RankQuantileOptions(
4075 sort_keys=[("", "descending", "at_start")])
4076 )
4077 assert result.to_pylist() == expected
4078
4079
4080@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

RankQuantileOptionsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected