Pandas MCQs with answers Page - 16

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 returns the correlation between columns of a DataFrame?

  • (A) corr()
  • (B) cov()
  • (C) correlate()
  • (D) relationship()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to change the data type of a column in pandas?

  • (A) astype()
  • (B) convert()
  • (C) change_type()
  • (D) dtype()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to set a column as the index of a DataFrame?

  • (A) set_index()
  • (B) index_column()
  • (C) assign_index()
  • (D) reset_index()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which pandas function is used to check if elements in a DataFrame are null?

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method stacks the prescribed level(s) from columns to index?

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method pivots the index into columns in pandas?

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method adds a new row or DataFrame to an existing DataFrame?

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which pandas function is used to create a DataFrame from a dictionary of lists?

  • (A) pd.DataFrame()
  • (B) pd.Series()
  • (C) pd.array()
  • (D) pd.dict()

S

Shyam Dubey • 3.70K Points
Extraordinary

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

  • (A) shape()
  • (B) len()
  • (C) df.shape
  • (D) size()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which pandas method is used to check for duplicate rows?

  • (A) duplicated()
  • (B) drop_duplicates()
  • (C) is_duplicate()
  • (D) unique()