MCPcopy
hub / github.com/pandas-dev/pandas / items

Method items

pandas/core/series.py:1693–1720  ·  view source on GitHub ↗

Lazily iterate over (index, value) tuples. This method returns an iterable tuple (index, value). This is convenient if you want to create a lazy iterator. Returns ------- iterable Iterable of tuples containing the (index, value) pairs fr

(self)

Source from the content-addressed store, hash-verified

1691 # ----------------------------------------------------------------------
1692
1693 def items(self) -> Iterable[tuple[Hashable, Any]]:
1694 """
1695 Lazily iterate over (index, value) tuples.
1696
1697 This method returns an iterable tuple (index, value). This is
1698 convenient if you want to create a lazy iterator.
1699
1700 Returns
1701 -------
1702 iterable
1703 Iterable of tuples containing the (index, value) pairs from a
1704 Series.
1705
1706 See Also
1707 --------
1708 DataFrame.items : Iterate over (column name, Series) pairs.
1709 DataFrame.iterrows : Iterate over DataFrame rows as (index, Series) pairs.
1710
1711 Examples
1712 --------
1713 >>> s = pd.Series(["A", "B", "C"])
1714 >>> for index, value in s.items():
1715 ... print(f"Index : {index}, Value : {value}")
1716 Index : 0, Value : A
1717 Index : 1, Value : B
1718 Index : 2, Value : C
1719 """
1720 return zip(iter(self.index), iter(self), strict=True)
1721
1722 # ----------------------------------------------------------------------
1723 # Misc public methods

Callers 15

to_dictMethod · 0.95
fillnaMethod · 0.95
_align_coreFunction · 0.95
test_binary_ops_alignMethod · 0.95
test_iterable_itemsMethod · 0.95
setup.pyFile · 0.45
get_versions_from_codeFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by 15

test_binary_ops_alignMethod · 0.76
test_iterable_itemsMethod · 0.76
test_int64_overflowMethod · 0.36
create_mgrFunction · 0.36
test_offsetMethod · 0.36
test_offsetMethod · 0.36
test_normalizeMethod · 0.36
test_applyMethod · 0.36