()
| 4053 | |
| 4054 | |
| 4055 | def 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 |
nothing calls this directly
no test coverage detected