| 766 | |
| 767 | |
| 768 | def test_clip_axis_1(): |
| 769 | df = pd.DataFrame( |
| 770 | { |
| 771 | "a": [1, 2, 3, 4, 5, 6, 7, 8, 9], |
| 772 | "b": [3, 5, 2, 5, 7, 2, 4, 2, 4], |
| 773 | } |
| 774 | ) |
| 775 | ddf = dd.from_pandas(df, 3) |
| 776 | l = pd.Series({"a": 2, "b": 3}) |
| 777 | u = pd.Series({"a": 7, "b": 5}) |
| 778 | |
| 779 | assert_eq(ddf.clip(lower=l, upper=u, axis=1), df.clip(lower=l, upper=u, axis=1)) |
| 780 | assert_eq(ddf.clip(lower=l, axis=1), df.clip(lower=l, axis=1)) |
| 781 | assert_eq(ddf.clip(upper=u, axis=1), df.clip(upper=u, axis=1)) |
| 782 | |
| 783 | with pytest.raises(ValueError, match="No axis named 1 for Series"): |
| 784 | ddf.a.clip(lower=l, upper=u, axis=1) |
| 785 | |
| 786 | |
| 787 | def test_squeeze(): |