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)
| 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 |
no outgoing calls