Pandas-Backend Entrypoint Class for Dask-DataFrame Note that all DataFrame-creation functions are defined and registered 'in-place' within the ``dask.dataframe`` ``io`` module.
| 805 | |
| 806 | |
| 807 | class PandasBackendEntrypoint(DataFrameBackendEntrypoint): |
| 808 | """Pandas-Backend Entrypoint Class for Dask-DataFrame |
| 809 | |
| 810 | Note that all DataFrame-creation functions are defined |
| 811 | and registered 'in-place' within the ``dask.dataframe`` |
| 812 | ``io`` module. |
| 813 | """ |
| 814 | |
| 815 | @classmethod |
| 816 | def to_backend_dispatch(cls): |
| 817 | return to_pandas_dispatch |
| 818 | |
| 819 | @classmethod |
| 820 | def to_backend(cls, data, **kwargs): |
| 821 | if isinstance(data._meta, (pd.DataFrame, pd.Series, pd.Index)): |
| 822 | # Already a pandas-backed collection |
| 823 | return data |
| 824 | return data.map_partitions(cls.to_backend_dispatch(), **kwargs) |
| 825 | |
| 826 | |
| 827 | dataframe_creation_dispatch.register_backend("pandas", PandasBackendEntrypoint()) |