Pandas MCQs with answers Page - 3

Here, you will find a collection of MCQ questions on Pandas. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 828.03K Points
Coach

Q. What is the default number of rows displayed by the `df.head()` method?

  • (A) 3
  • (B) 5
  • (C) 10
  • (D) 1

A

Admin • 828.03K Points
Coach

Q. Which method is used to reset the index of a DataFrame?

  • (A) df.set_index()
  • (B) df.index_reset()
  • (C) df.reset_index()
  • (D) df.restart_index()

A

Admin • 828.03K Points
Coach

Q. How to select rows where column 'A' is greater than 10?

  • (A) df['A'] > 10
  • (B) df[df['A'] > 10]
  • (C) df.select('A' > 10)
  • (D) df.where('A' > 10)

A

Admin • 828.03K Points
Coach

Q. Which of the following methods is used to apply a function to each element in a column?

  • (A) map()
  • (B) apply()
  • (C) applymap()
  • (D) transform()

A

Admin • 828.03K Points
Coach

Q. What does `groupby()` do in pandas?

  • (A) It joins multiple DataFrames
  • (B) It applies a function to grouped data
  • (C) It merges duplicate rows
  • (D) It deletes empty rows

A

Admin • 828.03K Points
Coach

Q. How to change the data type of a column in pandas?

  • (A) df.astype()
  • (B) df.change_type()
  • (C) df.convert()
  • (D) df.set_type()

A

Admin • 828.03K Points
Coach

Q. What does `drop(columns=['col1'])` do?

  • (A) Deletes the 'col1' row
  • (B) Deletes the 'col1' column
  • (C) Renames 'col1'
  • (D) Sorts 'col1'

A

Admin • 828.03K Points
Coach

Q. What is the output of `df.iloc[2]`?

  • (A) Column at index 2
  • (B) Row at label 2
  • (C) Row at index 2
  • (D) All rows starting from index 2

A

Admin • 828.03K Points
Coach

Q. Which method allows you to perform element-wise operations on the entire DataFrame?

  • (A) applymap()
  • (B) map()
  • (C) apply()
  • (D) transform()

A

Admin • 828.03K Points
Coach

Q. How to convert a column to datetime format?

  • (A) pd.to_datetime(df['col'])
  • (B) df['col'].astype('date')
  • (C) df['col'].to_date()
  • (D) pd.date(df['col'])

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ