CBSE Class 12 Informatics Practices Question 69 of 167

Python Pandas — I — Question 34

Back to all questions
34
Question

Question 34

To change the 5th column's value at 3rd row as 35 in dataframe DF, you can write ............... .

  1. DF[4, 6] = 35
  2. DF[3, 5] = 35
  3. DF.iat[4, 6] = 35
  4. DF.iat[3, 5] = 35
Answer

DF.iat[3, 5] = 35

Reason — The syntax to modify values using row and column position is <DataFrame>.iat[<row position>, <column position>]. Therefore, according to this syntax, DF.iat[3, 5] = 35 is used to change the 5th column's value at 3rd row as 35 in dataframe DF.