Home > Blockchain >  What is the difference betweend pandas.Series.items() and pandas.Series.iteritems()?
What is the difference betweend pandas.Series.items() and pandas.Series.iteritems()?

Time:08-13

As you can see the documentation pages for Series.items() and Series.iteritems() are identical. Is it a mistake? Is one method outdated but kept for backward compatibility?

Most importantly, which one should I use?

CodePudding user response:

Series.iteritems() just calls Series.items() under the hood, see source code below:

def iteritems(self) -> Iterable[tuple[Hashable, Any]]:
    return self.items()

Pandas Source

As a result, you should be fine to use either, although it appears Series.items() is preferred.

  • Related