CBSE Class 12 Informatics Practices Question 25 of 101

Python Pandas — II — Question 1

Back to all questions
1
Question

Question 1

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

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

iterrows()

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