pandas 1.4.2

Yields
iteritems(self) -> 'Iterable[tuple[Hashable, Series]]'

Iterates over the DataFrame columns, returning a tuple with the column name and the content as a Series.

Iterate over (column name, Series) pairs.

Yields

label : object

The column names for the DataFrame being iterated over.

content : Series

The column entries belonging to each label, as a Series.

See Also

DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.

DataFrame.itertuples

Iterate over DataFrame rows as namedtuples of the values.

Examples

This example is valid syntax, but we were not able to check execution
>>> df = pd.DataFrame({'species': ['bear', 'bear', 'marsupial'],
...  'population': [1864, 22000, 80000]},
...  index=['panda', 'polar', 'koala'])
... df species population panda bear 1864 polar bear 22000 koala marsupial 80000
This example is valid syntax, but we were not able to check execution
>>> for label, content in df.items():
...  print(f'label: {label}')
...  print(f'content: {content}', sep='\n') ... label: species content: panda bear polar bear koala marsupial Name: species, dtype: object label: population content: panda 1864 polar 22000 koala 80000 Name: population, dtype: int64
See :

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/frame.py#1275
type: <class 'function'>
Commit: