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

Function test_quantile

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

Source from the content-addressed store, hash-verified

1022@pytest.mark.parametrize("q", [0.75, [0.75]])
1023@pytest.mark.parametrize("rechunk", [True, False])
1024def test_quantile(rechunk, q, axis):
1025 shape = 10, 15, 20, 15
1026 arr = np.random.randn(*shape)
1027 indexer = np.random.randint(0, 10, size=shape)
1028 arr[indexer >= 8] = np.nan
1029
1030 darr = da.from_array(arr, chunks=(2, 3, 4, (5 if rechunk else -1)))
1031 assert_eq(da.quantile(darr, q, axis=axis), np.quantile(arr, q, axis=axis))
1032 assert_eq(
1033 da.quantile(darr, q, axis=axis, keepdims=True),
1034 np.quantile(arr, q, axis=axis, keepdims=True),
1035 )
1036 assert_eq(da.percentile(darr, q, axis=axis), np.percentile(arr, q, axis=axis))
1037 assert_eq(
1038 da.percentile(darr, q, axis=axis, keepdims=True),
1039 np.percentile(arr, q, axis=axis, keepdims=True),
1040 )
1041
1042
1043quantile_nanquantile = pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
randintMethod · 0.45
quantileMethod · 0.45

Tested by

no test coverage detected