| 2972 | |
| 2973 | |
| 2974 | def test_abs(): |
| 2975 | df = pd.DataFrame( |
| 2976 | { |
| 2977 | "A": [1, -2, 3, -4, 5], |
| 2978 | "B": [-6.0, -7, -8, -9, 10], |
| 2979 | "C": ["a", "b", "c", "d", "e"], |
| 2980 | } |
| 2981 | ) |
| 2982 | ddf = dd.from_pandas(df, npartitions=2) |
| 2983 | assert_eq(ddf.A.abs(), df.A.abs()) |
| 2984 | assert_eq(ddf[["A", "B"]].abs(), df[["A", "B"]].abs()) |
| 2985 | # raises TypeError with object dtype, but NotImplementedError with string[pyarrow] |
| 2986 | with pytest.raises((TypeError, NotImplementedError, ValueError)): |
| 2987 | ddf.C.abs() |
| 2988 | with pytest.raises((TypeError, NotImplementedError)): |
| 2989 | ddf.abs() |
| 2990 | |
| 2991 | |
| 2992 | def test_round(): |