Pandas MCQs with answers Page - 18

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to join two DataFrames based on their index?

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which pandas function reads a JSON file into a DataFrame?

  • (A) read_csv()
  • (B) read_json()
  • (C) read_excel()
  • (D) read_html()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method returns the number of non-null elements in each column or row?

  • (A) count()
  • (B) size()
  • (C) len()
  • (D) nunique()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which pandas method reshapes a DataFrame by pivoting the index and columns?

  • (A) pivot()
  • (B) pivot_table()
  • (C) melt()
  • (D) stack()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method returns a boolean DataFrame indicating where values are null?

  • (A) isnull()
  • (B) notnull()
  • (C) isna()
  • (D) Both A and C

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method allows conditional selection of rows in a DataFrame?

  • (A) loc[]
  • (B) iloc[]
  • (C) ix[]
  • (D) select_rows()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which pandas method converts a Series with categorical values to category dtype?

  • (A) astype('category')
  • (B) to_category()
  • (C) categorical()
  • (D) convert_category()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to get the correlation matrix of a DataFrame?

  • (A) cov()
  • (B) corr()
  • (C) correlation()
  • (D) describe()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to get the covariance matrix of a DataFrame?

  • (A) corr()
  • (B) cov()
  • (C) var()
  • (D) describe()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to shift the data in a Series or DataFrame by a certain number of periods?

  • (A) shift()
  • (B) move()
  • (C) lag()
  • (D) offset()

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