| 2963 | |
| 2964 | |
| 2965 | def test_abs(): |
| 2966 | df = pd.DataFrame( |
| 2967 | { |
| 2968 | "A": [1, -2, 3, -4, 5], |
| 2969 | "B": [-6.0, -7, -8, -9, 10], |
| 2970 | "C": ["a", "b", "c", "d", "e"], |
| 2971 | } |
| 2972 | ) |
| 2973 | ddf = dd.from_pandas(df, npartitions=2) |
| 2974 | assert_eq(ddf.A.abs(), df.A.abs()) |
| 2975 | assert_eq(ddf[["A", "B"]].abs(), df[["A", "B"]].abs()) |
| 2976 | # raises TypeError with object dtype, but NotImplementedError with string[pyarrow] |
| 2977 | with pytest.raises((TypeError, NotImplementedError, ValueError)): |
| 2978 | ddf.C.abs() |
| 2979 | with pytest.raises((TypeError, NotImplementedError)): |
| 2980 | ddf.abs() |
| 2981 | |
| 2982 | |
| 2983 | def test_round(): |