CBSE Class 12 Informatics Practices Question 66 of 167

Python Pandas — I — Question 31

Back to all questions
31
Question

Question 31

To get the transpose of a dataframe D1, you can write ............... .

  1. D1.T
  2. D1.Transpose
  3. D1.Swap
  4. All of these
Answer

D1.T

Reason — We can transpose a DataFrame by swapping its indexes and columns using the attribute T, with the syntax DataFrame.T. Therefore, D1.T is used to get the transpose of a DataFrame D1.