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

Function test_idxmaxmin_numeric_only

dask/dataframe/tests/test_dataframe.py:3766–3789  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

3764
3765@pytest.mark.parametrize("func", ["idxmin", "idxmax"])
3766def test_idxmaxmin_numeric_only(func):
3767 df = pd.DataFrame(
3768 {
3769 "int": [1, 2, 3, 4, 5, 6, 7, 8],
3770 "float": [1.0, 2.0, 3.0, 4.0, np.nan, 6.0, 7.0, 8.0],
3771 "dt": [pd.NaT] + [datetime(2010, i, 1) for i in range(1, 8)],
3772 "timedelta": pd.to_timedelta([1, 2, 3, 4, 5, 6, 7, np.nan]),
3773 "bool": [True, False] * 4,
3774 }
3775 )
3776 ddf = dd.from_pandas(df, npartitions=2)
3777 assert_eq(
3778 getattr(ddf, func)(numeric_only=False),
3779 getattr(df, func)(numeric_only=False).sort_index(),
3780 )
3781 assert_eq(
3782 getattr(ddf, func)(numeric_only=True),
3783 getattr(df, func)(numeric_only=True).sort_index(),
3784 )
3785
3786 assert_eq(
3787 getattr(ddf.drop(columns="bool"), func)(numeric_only=True, axis=1),
3788 getattr(df.drop(columns="bool"), func)(numeric_only=True, axis=1).sort_index(),
3789 )
3790
3791
3792def test_idxmaxmin_empty_partitions():

Callers

nothing calls this directly

Calls 2

dropMethod · 0.95
assert_eqFunction · 0.90

Tested by

no test coverage detected