def to_dict(self, orient: str='dict', into: Type=dict) -> Union[(List, Mapping)]:
    "\n        Convert the DataFrame to a dictionary.\n\n        The type of the key-value pairs can be customized with the parameters\n        (see below).\n\n        .. note:: This method should only be used if the resulting pandas DataFrame is expected\n            to be small, as all the data is loaded into the driver's memory.\n\n        Parameters\n        ----------\n        orient : str {'dict', 'list', 'series', 'split', 'records', 'index'}\n            Determines the type of the values of the dictionary.\n\n            - 'dict' (default) : dict like {column -> {index -> value}}\n            - 'list' : dict like {column -> [values]}\n            - 'series' : dict like {column -> Series(values)}\n            - 'split' : dict like\n              {'index' -> [index], 'columns' -> [columns], 'data' -> [values]}\n            - 'records' : list like\n              [{column -> value}, ... , {column -> value}]\n            - 'index' : dict like {index -> {column -> value}}\n\n            Abbreviations are allowed. `s` indicates `series` and `sp`\n            indicates `split`.\n\n        into : class, default dict\n            The collections.abc.Mapping subclass used for all Mappings\n            in the return value.  Can be the actual class or an empty\n            instance of the mapping type you want.  If you want a\n            collections.defaultdict, you must pass it initialized.\n\n        Returns\n        -------\n        dict, list or collections.abc.Mapping\n            Return a collections.abc.Mapping object representing the DataFrame.\n            The resulting transformation depends on the `orient` parameter.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'col1': [1, 2],\n        ...                    'col2': [0.5, 0.75]},\n        ...                   index=['row1', 'row2'],\n        ...                   columns=['col1', 'col2'])\n        >>> df\n              col1  col2\n        row1     1  0.50\n        row2     2  0.75\n\n        >>> df_dict = df.to_dict()\n        >>> sorted([(key, sorted(values.items())) for key, values in df_dict.items()])\n        [('col1', [('row1', 1), ('row2', 2)]), ('col2', [('row1', 0.5), ('row2', 0.75)])]\n\n        You can specify the return orientation.\n\n        >>> df_dict = df.to_dict('series')\n        >>> sorted(df_dict.items())\n        [('col1', row1    1\n        row2    2\n        Name: col1, dtype: int64), ('col2', row1    0.50\n        row2    0.75\n        Name: col2, dtype: float64)]\n\n        >>> df_dict = df.to_dict('split')\n        >>> sorted(df_dict.items())  # doctest: +ELLIPSIS\n        [('columns', ['col1', 'col2']), ('data', [[1..., 0.75]]), ('index', ['row1', 'row2'])]\n\n        >>> df_dict = df.to_dict('records')\n        >>> [sorted(values.items()) for values in df_dict]  # doctest: +ELLIPSIS\n        [[('col1', 1...), ('col2', 0.5)], [('col1', 2...), ('col2', 0.75)]]\n\n        >>> df_dict = df.to_dict('index')\n        >>> sorted([(key, sorted(values.items())) for key, values in df_dict.items()])\n        [('row1', [('col1', 1), ('col2', 0.5)]), ('row2', [('col1', 2), ('col2', 0.75)])]\n\n        You can also specify the mapping type.\n\n        >>> from collections import OrderedDict, defaultdict\n        >>> df.to_dict(into=OrderedDict)\n        OrderedDict([('col1', OrderedDict([('row1', 1), ('row2', 2)])), ('col2', OrderedDict([('row1', 0.5), ('row2', 0.75)]))])\n\n        If you want a `defaultdict`, you need to initialize it:\n\n        >>> dd = defaultdict(list)\n        >>> df.to_dict('records', into=dd)  # doctest: +ELLIPSIS\n        [defaultdict(<class 'list'>, {'col..., 'col...}), defaultdict(<class 'list'>, {'col..., 'col...})]\n        "
    args = locals()
    psdf = self
    return validate_arguments_and_invoke_function(psdf._to_internal_pandas(), self.to_dict, pd.DataFrame.to_dict, args)
Convert the DataFrame to a dictionary.

The type of the key-value pairs can be customized with the parameters
(see below).

.. note:: This method should only be used if the resulting pandas DataFrame is expected
    to be small, as all the data is loaded into the driver's memory.

Parameters
----------
orient : str {'dict', 'list', 'series', 'split', 'records', 'index'}
    Determines the type of the values of the dictionary.

    - 'dict' (default) : dict like {column -> {index -> value}}
    - 'list' : dict like {column -> [values]}
    - 'series' : dict like {column -> Series(values)}
    - 'split' : dict like
      {'index' -> [index], 'columns' -> [columns], 'data' -> [values]}
    - 'records' : list like
      [{column -> value}, ... , {column -> value}]
    - 'index' : dict like {index -> {column -> value}}

    Abbreviations are allowed. `s` indicates `series` and `sp`
    indicates `split`.

into : class, default dict
    The collections.abc.Mapping subclass used for all Mappings
    in the return value.  Can be the actual class or an empty
    instance of the mapping type you want.  If you want a
    collections.defaultdict, you must pass it initialized.

Returns
-------
dict, list or collections.abc.Mapping
    Return a collections.abc.Mapping object representing the DataFrame.
    The resulting transformation depends on the `orient` parameter.

Examples
--------
>>> df = ps.DataFrame({'col1': [1, 2],
...                    'col2': [0.5, 0.75]},
...                   index=['row1', 'row2'],
...                   columns=['col1', 'col2'])
>>> df
      col1  col2
row1     1  0.50
row2     2  0.75

>>> df_dict = df.to_dict()
>>> sorted([(key, sorted(values.items())) for key, values in df_dict.items()])
[('col1', [('row1', 1), ('row2', 2)]), ('col2', [('row1', 0.5), ('row2', 0.75)])]

You can specify the return orientation.

>>> df_dict = df.to_dict('series')
>>> sorted(df_dict.items())
[('col1', row1    1
row2    2
Name: col1, dtype: int64), ('col2', row1    0.50
row2    0.75
Name: col2, dtype: float64)]

>>> df_dict = df.to_dict('split')
>>> sorted(df_dict.items())  # doctest: +ELLIPSIS
[('columns', ['col1', 'col2']), ('data', [[1..., 0.75]]), ('index', ['row1', 'row2'])]

>>> df_dict = df.to_dict('records')
>>> [sorted(values.items()) for values in df_dict]  # doctest: +ELLIPSIS
[[('col1', 1...), ('col2', 0.5)], [('col1', 2...), ('col2', 0.75)]]

>>> df_dict = df.to_dict('index')
>>> sorted([(key, sorted(values.items())) for key, values in df_dict.items()])
[('row1', [('col1', 1), ('col2', 0.5)]), ('row2', [('col1', 2), ('col2', 0.75)])]

You can also specify the mapping type.

>>> from collections import OrderedDict, defaultdict
>>> df.to_dict(into=OrderedDict)
OrderedDict([('col1', OrderedDict([('row1', 1), ('row2', 2)])), ('col2', OrderedDict([('row1', 0.5), ('row2', 0.75)]))])

If you want a `defaultdict`, you need to initialize it:

>>> dd = defaultdict(list)
>>> df.to_dict('records', into=dd)  # doctest: +ELLIPSIS
[defaultdict(<class 'list'>, {'col..., 'col...}), defaultdict(<class 'list'>, {'col..., 'col...})]
def to_dict(self, orient: str='dict', into: Type=dict) -> Union[(List, Mapping)]:
    "\n        Convert the DataFrame to a dictionary.\n\n        The type of the key-value pairs can be customized with the parameters\n        (see below).\n\n        .. note:: This method should only be used if the resulting pandas DataFrame is expected\n            to be small, as all the data is loaded into the driver's memory.\n\n        Parameters\n        ----------\n        orient : str {'dict', 'list', 'series', 'split', 'records', 'index'}\n            Determines the type of the values of the dictionary.\n\n            - 'dict' (default) : dict like {column -> {index -> value}}\n            - 'list' : dict like {column -> [values]}\n            - 'series' : dict like {column -> Series(values)}\n            - 'split' : dict like\n              {'index' -> [index], 'columns' -> [columns], 'data' -> [values]}\n            - 'records' : list like\n              [{column -> value}, ... , {column -> value}]\n            - 'index' : dict like {index -> {column -> value}}\n\n            Abbreviations are allowed. `s` indicates `series` and `sp`\n            indicates `split`.\n\n        into : class, default dict\n            The collections.abc.Mapping subclass used for all Mappings\n            in the return value.  Can be the actual class or an empty\n            instance of the mapping type you want.  If you want a\n            collections.defaultdict, you must pass it initialized.\n\n        Returns\n        -------\n        dict, list or collections.abc.Mapping\n            Return a collections.abc.Mapping object representing the DataFrame.\n            The resulting transformation depends on the `orient` parameter.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'col1': [1, 2],\n        ...                    'col2': [0.5, 0.75]},\n        ...                   index=['row1', 'row2'],\n        ...                   columns=['col1', 'col2'])\n        >>> df\n              col1  col2\n        row1     1  0.50\n        row2     2  0.75\n\n        >>> df_dict = df.to_dict()\n        >>> sorted([(key, sorted(values.items())) for key, values in df_dict.items()])\n        [('col1', [('row1', 1), ('row2', 2)]), ('col2', [('row1', 0.5), ('row2', 0.75)])]\n\n        You can specify the return orientation.\n\n        >>> df_dict = df.to_dict('series')\n        >>> sorted(df_dict.items())\n        [('col1', row1    1\n        row2    2\n        Name: col1, dtype: int64), ('col2', row1    0.50\n        row2    0.75\n        Name: col2, dtype: float64)]\n\n        >>> df_dict = df.to_dict('split')\n        >>> sorted(df_dict.items())  # doctest: +ELLIPSIS\n        [('columns', ['col1', 'col2']), ('data', [[1..., 0.75]]), ('index', ['row1', 'row2'])]\n\n        >>> df_dict = df.to_dict('records')\n        >>> [sorted(values.items()) for values in df_dict]  # doctest: +ELLIPSIS\n        [[('col1', 1...), ('col2', 0.5)], [('col1', 2...), ('col2', 0.75)]]\n\n        >>> df_dict = df.to_dict('index')\n        >>> sorted([(key, sorted(values.items())) for key, values in df_dict.items()])\n        [('row1', [('col1', 1), ('col2', 0.5)]), ('row2', [('col1', 2), ('col2', 0.75)])]\n\n        You can also specify the mapping type.\n\n        >>> from collections import OrderedDict, defaultdict\n        >>> df.to_dict(into=OrderedDict)\n        OrderedDict([('col1', OrderedDict([('row1', 1), ('row2', 2)])), ('col2', OrderedDict([('row1', 0.5), ('row2', 0.75)]))])\n\n        If you want a `defaultdict`, you need to initialize it:\n\n        >>> dd = defaultdict(list)\n        >>> df.to_dict('records', into=dd)  # doctest: +ELLIPSIS\n        [defaultdict(<class 'list'>, {'col..., 'col...}), defaultdict(<class 'list'>, {'col..., 'col...})]\n        "
    args = locals()
    psdf = self
    return validate_arguments_and_invoke_function(psdf._to_internal_pandas(), self.to_dict, pd.DataFrame.to_dict, args)