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

Function test_clip_axis_0

dask/dataframe/tests/test_dataframe.py:743–765  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

741
742
743def test_clip_axis_0():
744 df = pd.DataFrame(
745 {
746 "a": [1, 2, 3, 4, 5, 6, 7, 8, 9],
747 "b": [3, 5, 2, 5, 7, 2, 4, 2, 4],
748 }
749 )
750 s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9])
751 l = pd.Series([3] * len(df))
752 u = pd.Series([7] * len(df))
753
754 ddf = dd.from_pandas(df, 3)
755 ds = dd.from_pandas(s, 3)
756 dl = dd.from_pandas(l, 3)
757 du = dd.from_pandas(u, 3)
758
759 assert_eq(ddf.clip(lower=dl, upper=du, axis=0), df.clip(lower=l, upper=u, axis=0))
760 assert_eq(ddf.clip(lower=dl, axis=0), df.clip(lower=l, axis=0))
761 assert_eq(ddf.clip(upper=du, axis=0), df.clip(upper=u, axis=0))
762
763 assert_eq(ds.clip(lower=dl, upper=du, axis=0), s.clip(lower=l, upper=u, axis=0))
764 assert_eq(ds.clip(lower=dl, axis=0), s.clip(lower=l, axis=0))
765 assert_eq(ds.clip(upper=du, axis=0), s.clip(upper=u, axis=0))
766
767
768def test_clip_axis_1():

Callers

nothing calls this directly

Calls 4

clipMethod · 0.95
clipMethod · 0.95
assert_eqFunction · 0.90
clipMethod · 0.45

Tested by

no test coverage detected