Repository: geopandas/dask-geopandas

Issue:
BUG: to_dask_dataframe method doesn't work
`dask_geopandas.GeoDataFrame.to_dask_dataframe()` method doesn't work and even cannot work as it assumes `geopandas.GeoDataFrame.to_pandas()` method that doesn't exist.

https://github.com/geopandas/dask-geopandas/blob/f18ae2c7572969b8cf331555298c83bbdf18c426/dask_geopandas/core.py#L62-L64



Discussion:

Patch:
diff --git a/dask_geopandas/core.py b/dask_geopandas/core.py
index 60fe0e5..9cb5831 100644
--- a/dask_geopandas/core.py
+++ b/dask_geopandas/core.py
@@ -59,7 +59,7 @@ class _Frame(dd.core._Frame, OperatorMethodMixin):
 
     def to_dask_dataframe(self):
         """Create a dask.dataframe object from a dask_geopandas object"""
-        return self.map_partitions(M.to_pandas)
+        return self.map_partitions(pd.DataFrame)
 
     def __dask_postcompute__(self):
         return _finalize, ()
diff --git a/doc/source/docs/reference/geodataframe.rst b/doc/source/docs/reference/geodataframe.rst
index ca3f33e..da467ca 100644
--- a/doc/source/docs/reference/geodataframe.rst
+++ b/doc/source/docs/reference/geodataframe.rst
@@ -19,6 +19,7 @@ Serialization / IO / conversion
 .. autosummary::
    :toctree: api/
 
+   GeoDataFrame.to_dask_dataframe
    GeoDataFrame.to_parquet
    GeoDataFrame.to_wkb
    GeoDataFrame.to_wkt


Test patch:
diff --git a/tests/test_core.py b/tests/test_core.py
index a0b9cec..afd40d7 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -817,3 +817,19 @@ def test_get_coord(coord):
     expected = getattr(s, coord)
     result = getattr(dask_obj, coord).compute()
     assert_series_equal(expected, result)
+
+
+def test_to_dask_dataframe(geodf_points_crs):
+    df = geodf_points_crs
+    dask_gpd = dask_geopandas.from_geopandas(df, npartitions=2)
+    dask_df = dask_gpd.to_dask_dataframe()
+
+    assert isinstance(dask_df, dd.DataFrame) and not isinstance(
+        dask_df, dask_geopandas.GeoDataFrame
+    )
+    expected = pd.DataFrame(df)
+    result = dask_df.compute()
+    assert_frame_equal(result, expected)
+    assert isinstance(result, pd.DataFrame) and not isinstance(
+        result, geopandas.GeoDataFrame
+    )