pandas 1.4.2

ParametersReturnsBackRef
to_dict(self, into=<class 'dict'>)

Parameters

into : class, default dict

The collections.abc.Mapping subclass to use as the return object. 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

collections.abc.Mapping

Key-value representation of Series.

Convert Series to {label -> value} dict or dict-like object.

Examples

This example is valid syntax, but we were not able to check execution
>>> s = pd.Series([1, 2, 3, 4])
... s.to_dict() {0: 1, 1: 2, 2: 3, 3: 4}
This example is valid syntax, but we were not able to check execution
>>> from collections import OrderedDict, defaultdict
... s.to_dict(OrderedDict) OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)])
This example is valid syntax, but we were not able to check execution
>>> dd = defaultdict(list)
... s.to_dict(dd) defaultdict(<class 'list'>, {0: 1, 1: 2, 2: 3, 3: 4})
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.common.standardize_mapping

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/series.py#1709
type: <class 'function'>
Commit: