CBSE Class 12 Informatics Practices Question 26 of 101

Python Pandas — II — Question 2

Back to all questions
2
Question

Question 2

To iterate over vertical subsets of a DataFrame, ............... function may be used.

  1. iterate()
  2. iterrows()
  3. itercols()
  4. iteritems()
Answer

iteritems()

Reason — The iteritems() method in pandas iterates over a DataFrame column-wise, where each vertical subset is in the form of (column-index, Series) where Series contains all row values for that column-index.