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

Function test_clip_axis_0

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

Source from the content-addressed store, hash-verified

759
760
761def test_clip_axis_0():
762 df = pd.DataFrame(
763 {
764 "a": [1, 2, 3, 4, 5, 6, 7, 8, 9],
765 "b": [3, 5, 2, 5, 7, 2, 4, 2, 4],
766 }
767 )
768 s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9])
769 l = pd.Series([3] * len(df))
770 u = pd.Series([7] * len(df))
771
772 ddf = dd.from_pandas(df, 3)
773 ds = dd.from_pandas(s, 3)
774 dl = dd.from_pandas(l, 3)
775 du = dd.from_pandas(u, 3)
776
777 assert_eq(ddf.clip(lower=dl, upper=du, axis=0), df.clip(lower=l, upper=u, axis=0))
778 assert_eq(ddf.clip(lower=dl, axis=0), df.clip(lower=l, axis=0))
779 assert_eq(ddf.clip(upper=du, axis=0), df.clip(upper=u, axis=0))
780
781 assert_eq(ds.clip(lower=dl, upper=du, axis=0), s.clip(lower=l, upper=u, axis=0))
782 assert_eq(ds.clip(lower=dl, axis=0), s.clip(lower=l, axis=0))
783 assert_eq(ds.clip(upper=du, axis=0), s.clip(upper=u, axis=0))
784
785
786def 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