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

Function test_mode_numeric_only

dask/dataframe/dask_expr/tests/test_reductions.py:391–404  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389
390
391def test_mode_numeric_only():
392 df = pd.DataFrame(
393 {
394 "int": [1, 2, 3, 4, 5, 6, 7, 8],
395 "float": [1.0, 2.0, 3.0, 4.0, np.nan, 6.0, 7.0, 8.0],
396 "dt": [pd.NaT] + [datetime(2010, i, 1) for i in range(1, 8)],
397 "timedelta": pd.to_timedelta([1, 2, 3, 4, 5, 6, 7, np.nan]),
398 }
399 )
400 ddf = from_pandas(df, npartitions=2)
401
402 assert_eq(ddf.mode(numeric_only=False), df.mode(numeric_only=False))
403 assert_eq(ddf.mode(), df.mode())
404 assert_eq(ddf.mode(numeric_only=True), df.mode(numeric_only=True))
405
406
407def test_divmod():

Callers

nothing calls this directly

Calls 4

modeMethod · 0.95
from_pandasFunction · 0.90
assert_eqFunction · 0.90
modeMethod · 0.45

Tested by

no test coverage detected