Pandas MCQs with answers Page - 5

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 • 833.24K Points
Coach

Q. Which method converts a DataFrame to a NumPy array?

  • (A) df.to_numpy()
  • (B) df.to_array()
  • (C) df.as_matrix()
  • (D) df.values()

A

Admin • 833.24K Points
Coach

Q. What will `df['col'].nlargest(3)` return?

  • (A) Smallest 3 values
  • (B) 3 random values
  • (C) 3 largest values
  • (D) First 3 rows

A

Admin • 833.24K Points
Coach

Q. Which method combines DataFrames by aligning on index?

  • (A) merge()
  • (B) concat()
  • (C) join()
  • (D) combine()

A

Admin • 833.24K Points
Coach

Q. Which of the following returns the median value of a Series?

  • (A) mean()
  • (B) sum()
  • (C) mode()
  • (D) median()

A

Admin • 833.24K Points
Coach

Q. Which function is used to save a DataFrame to a CSV file?

  • (A) df.write_csv()
  • (B) df.export_csv()
  • (C) df.to_csv()
  • (D) df.save_csv()

A

Admin • 833.24K Points
Coach

Q. What does `df.loc[0]` return?

  • (A) First column
  • (B) Row with label 0
  • (C) Third row
  • (D) Column with label 0

A

Admin • 833.24K Points
Coach

Q. Which of the following will create a date range of 7 days starting from 2022-01-01?

  • (A) pd.date_range('2022-01-01', periods=7)
  • (B) pd.date_range(start='2022-01-01', end='2022-01-07')
  • (C) Both a and b
  • (D) None of the above

A

Admin • 833.24K Points
Coach

Q. What is the output type of `df['col'].value_counts()`?

  • (A) DataFrame
  • (B) Series
  • (C) List
  • (D) Dictionary

A

Admin • 833.24K Points
Coach

Q. Which method allows applying custom row-wise functions?

  • (A) map()
  • (B) applymap()
  • (C) apply() with axis=1
  • (D) transform()

A

Admin • 833.24K Points
Coach

Q. What will `df.sample(n=3)` do?

  • (A) Return the first 3 rows
  • (B) Return the last 3 rows
  • (C) Return 3 random rows
  • (D) Return rows with 3 in them

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