Repository: dask/dask
Pull request: Remove hard pandas dependency for melt by using methodcaller
**Summary of Changes**
- This PR updates the `melt` function to use `M.melt` instead of `pd.melt`, removing the hard coding of dask's `melt` function to pandas.

- [ X ] Tests added / passed
    - ```====================================== 5358 passed, 472 skipped, 23 xfailed, 6 xpassed, 149 warnings in 793.61 seconds ======================================```

- [ X ] Passes `flake8 dask`


This closes #4718 .

Problem statement:
[FEA] Use M methodcaller in melt
### Request
As a dask user, I'd like to be able to potentially use `melt` for multiple types of dataframe data structures. Currently, melt is hard tied to pandas via `pd.melt`. Switching dask's melt to use the `M` methodcaller should make this possible.

Note: I'm going to open a PR for this issue.

Hints from issue discussion:

Commit message: remove hard pandas dependency for melt by using methodcaller

Patch to review:
diff --git a/dask/dataframe/reshape.py b/dask/dataframe/reshape.py
index 528249e794b..75bfb3dcf54 100644
--- a/dask/dataframe/reshape.py
+++ b/dask/dataframe/reshape.py
@@ -239,8 +239,9 @@ def melt(frame, id_vars=None, value_vars=None, var_name=None,
          value_name='value', col_level=None):
 
     from dask.dataframe.core import no_default
+    from ..utils import M
 
-    return frame.map_partitions(pd.melt, meta=no_default, id_vars=id_vars,
+    return frame.map_partitions(M.melt, meta=no_default, id_vars=id_vars,
                                 value_vars=value_vars,
                                 var_name=var_name, value_name=value_name,
                                 col_level=col_level, token='melt')


Code review comments:
diff_hunk: @@ -239,8 +239,9 @@ def melt(frame, id_vars=None, value_vars=None, var_name=None,
          value_name='value', col_level=None):
 
     from dask.dataframe.core import no_default
+    from ..utils import M
path: dask/dataframe/reshape.py
text: @user1:
In general this looks good to me, but if possible it would be good to move this import up to the top of the file.

@author:
Sure. Would you prefer the already existing `from dask.dataframe.core import no_default` be moved up as well?

@user1:
I suspect that that is here because placing it at the top would cause a circular import (core.py probably imports reshape.py)

@user1:
We shouldn't run into the same difficulty with utils.py