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

Function test_shift

dask/dataframe/dask_expr/tests/test_collection.py:466–477  ·  view source on GitHub ↗
(xfail, pdf, df, periods, freq, axis)

Source from the content-addressed store, hash-verified

464@pytest.mark.parametrize("freq", (None, "1h", timedelta(hours=1)))
465@pytest.mark.parametrize("axis", ("index", 0, "columns", 1))
466def test_shift(xfail, pdf, df, periods, freq, axis):
467 if freq and axis in ("columns", 1):
468 xfail(reason="Neither dask or pandas supports freq w/ axis 1 shift")
469
470 if freq is not None:
471 pdf["time"] = pd.date_range("2000-01-01", "2000-01-02", periods=len(pdf))
472 pdf = pdf.set_index("time", drop=True)
473 df = from_pandas(pdf, npartitions=df.npartitions)
474
475 actual = df.shift(periods=periods, axis=axis, freq=freq)
476 expected = pdf.shift(periods=periods, axis=axis, freq=freq)
477 assert_eq(actual, expected)
478
479
480def test_memory_usage(pdf):

Callers

nothing calls this directly

Calls 5

from_pandasFunction · 0.90
assert_eqFunction · 0.90
xfailFunction · 0.85
set_indexMethod · 0.80
shiftMethod · 0.45

Tested by

no test coverage detected