MCPcopy Create free account
hub / github.com/dask/dask / test_quantile

Function test_quantile

dask/array/tests/test_reductions.py:950–966  ·  view source on GitHub ↗
(rechunk, q, axis)

Source from the content-addressed store, hash-verified

948@pytest.mark.parametrize("q", [0.75, [0.75]])
949@pytest.mark.parametrize("rechunk", [True, False])
950def test_quantile(rechunk, q, axis):
951 shape = 10, 15, 20, 15
952 arr = np.random.randn(*shape)
953 indexer = np.random.randint(0, 10, size=shape)
954 arr[indexer >= 8] = np.nan
955
956 darr = da.from_array(arr, chunks=(2, 3, 4, (5 if rechunk else -1)))
957 assert_eq(da.quantile(darr, q, axis=axis), np.quantile(arr, q, axis=axis))
958 assert_eq(
959 da.quantile(darr, q, axis=axis, keepdims=True),
960 np.quantile(arr, q, axis=axis, keepdims=True),
961 )
962 assert_eq(da.percentile(darr, q, axis=axis), np.percentile(arr, q, axis=axis))
963 assert_eq(
964 da.percentile(darr, q, axis=axis, keepdims=True),
965 np.percentile(arr, q, axis=axis, keepdims=True),
966 )
967
968
969@pytest.mark.parametrize("func", [da.quantile, da.nanquantile, da.nanpercentile])

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
randintMethod · 0.45
quantileMethod · 0.45

Tested by

no test coverage detected