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

Function test_quantile_frame

dask/dataframe/dask_expr/tests/test_collection.py:2293–2312  ·  view source on GitHub ↗
(df, pdf)

Source from the content-addressed store, hash-verified

2291
2292
2293def test_quantile_frame(df, pdf):
2294 assert_eq(df.quantile(), pd.Series([49.0, 7.0], index=["x", "y"], name=0.5))
2295 assert df.quantile().divisions == ("x", "y")
2296 assert_eq(df.quantile(q=[0.5]), pd.DataFrame({"x": [49.0], "y": 7.0}, index=[0.5]))
2297 assert_eq(
2298 df.quantile(q=[0.5], numeric_only=True),
2299 pd.DataFrame({"x": [49.0], "y": 7.0}, index=[0.5]),
2300 )
2301
2302 pdf["z"] = 1
2303 df = from_pandas(pdf, npartitions=10)
2304 q = df.quantile(q=[0.5])[["x", "z"]]
2305 assert q.optimize()._name == df[["x", "z"]].quantile(q=[0.5]).optimize()._name
2306
2307 q = df.quantile(q=0.5)[["x", "z"]]
2308 assert (
2309 q.optimize()._name
2310 == df[["x", "z"]].quantile(q=0.5)[["x", "z"]].optimize()._name
2311 )
2312 assert_eq(df.quantile(axis=1), pdf.quantile(axis=1))
2313
2314
2315def test_combine():

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
from_pandasFunction · 0.90
quantileMethod · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected