Pandas MCQs with answers Page - 2

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. What does `df.shape` return?

  • (A) Total elements
  • (B) List of column names
  • (C) Tuple of (rows, columns)
  • (D) Data types of columns

A

Admin • 833.24K Points
Coach

Q. How to sort a DataFrame by a column 'Salary'?

  • (A) df.sort('Salary')
  • (B) df.sort_by('Salary')
  • (C) df.order('Salary')
  • (D) df.sort_values('Salary')

A

Admin • 833.24K Points
Coach

Q. What does the `info()` method show?

  • (A) Only data types
  • (B) Only memory usage
  • (C) Data types, non-null counts, memory usage
  • (D) Only null values

A

Admin • 833.24K Points
Coach

Q. Which method is used to fill missing values?

  • (A) fillna()
  • (B) replace_na()
  • (C) fixna()
  • (D) complete_na()

A

Admin • 833.24K Points
Coach

Q. Which function merges two DataFrames on a common column?

  • (A) pd.combine()
  • (B) pd.concat()
  • (C) pd.merge()
  • (D) pd.mix()

A

Admin • 833.24K Points
Coach

Q. How do you check for missing values in a DataFrame?

  • (A) df.checkna()
  • (B) df.hasna()
  • (C) df.isnull()
  • (D) df.missing()

A

Admin • 833.24K Points
Coach

Q. What is the default axis for `drop()` in pandas?

  • (A) axis=0 (rows)
  • (B) axis=1 (columns)
  • (C) axis=None
  • (D) axis='index'

A

Admin • 833.24K Points
Coach

Q. Which attribute gives the data types of each column?

  • (A) df.types
  • (B) df.dtypes
  • (C) df.datatypes
  • (D) df.columns.types

A

Admin • 833.24K Points
Coach

Q. How do you rename columns in a DataFrame?

  • (A) df.rename(columns={'old':'new'})
  • (B) df.columns.rename()
  • (C) df.rename_column()
  • (D) df.set_columns()

A

Admin • 833.24K Points
Coach

Q. Which function returns the number of non-null elements in each column?

  • (A) df.size()
  • (B) df.count()
  • (C) df.length()
  • (D) df.total()

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