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

Function test_quantile_frame

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

Source from the content-addressed store, hash-verified

2253
2254
2255def test_quantile_frame(df, pdf):
2256 assert_eq(df.quantile(), pd.Series([49.0, 7.0], index=["x", "y"], name=0.5))
2257 assert df.quantile().divisions == ("x", "y")
2258 assert_eq(df.quantile(q=[0.5]), pd.DataFrame({"x": [49.0], "y": 7.0}, index=[0.5]))
2259 assert_eq(
2260 df.quantile(q=[0.5], numeric_only=True),
2261 pd.DataFrame({"x": [49.0], "y": 7.0}, index=[0.5]),
2262 )
2263
2264 pdf["z"] = 1
2265 df = from_pandas(pdf, npartitions=10)
2266 q = df.quantile(q=[0.5])[["x", "z"]]
2267 assert q.optimize()._name == df[["x", "z"]].quantile(q=[0.5]).optimize()._name
2268
2269 q = df.quantile(q=0.5)[["x", "z"]]
2270 assert (
2271 q.optimize()._name
2272 == df[["x", "z"]].quantile(q=0.5)[["x", "z"]].optimize()._name
2273 )
2274 assert_eq(df.quantile(axis=1), pdf.quantile(axis=1))
2275
2276
2277def 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