| 1509 | ], |
| 1510 | ) |
| 1511 | def test_melt(kwargs): |
| 1512 | pdf = pd.DataFrame( |
| 1513 | { |
| 1514 | "obj": list("abcd") * 5, |
| 1515 | "s1": list("XY") * 10, |
| 1516 | "s2": list("abcde") * 4, |
| 1517 | "int": np.random.randn(20), |
| 1518 | } |
| 1519 | ) |
| 1520 | if pa: |
| 1521 | # If pyarrow is installed, test that `string[pyarrow]` dtypes |
| 1522 | # give the same result with `pandas` and `dask` |
| 1523 | pdf = pdf.astype({"s1": "string[pyarrow]", "s2": "string[pyarrow]"}) |
| 1524 | |
| 1525 | ddf = dd.from_pandas(pdf, 4) |
| 1526 | |
| 1527 | list_eq(dd.melt(ddf, **kwargs), pd.melt(pdf, **kwargs)) |
| 1528 | # test again as DataFrame method |
| 1529 | list_eq(ddf.melt(**kwargs), pdf.melt(**kwargs)) |
| 1530 | |
| 1531 | |
| 1532 | def test_cheap_inner_merge_with_pandas_object(): |