MCPcopy
hub / github.com/dask/dask / test_shift

Function test_shift

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…