Pandas MCQs with answers Page - 11

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 is the output type of `df.dtypes`?

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

A

Admin • 833.24K Points
Coach

Q. Which method checks if any value in a DataFrame is null?

  • (A) df.hasnull()
  • (B) df.isnull().any()
  • (C) df.check_null()
  • (D) df.isnan()

A

Admin • 833.24K Points
Coach

Q. How do you change the column names of a DataFrame?

  • (A) df.columns = ['A', 'B']
  • (B) df.rename(columns=['A', 'B'])
  • (C) df.set_columns(['A', 'B'])
  • (D) df.change_columns(['A', 'B'])

A

Admin • 833.24K Points
Coach

Q. What is the purpose of `drop_duplicates()`?

  • (A) Removes columns with same name
  • (B) Removes duplicate rows
  • (C) Drops NaN values
  • (D) Sorts the DataFrame

A

Admin • 833.24K Points
Coach

Q. Which method is used to set multiple columns as the index?

  • (A) set_index() with a list of column names
  • (B) index_by()
  • (C) multi_index()
  • (D) set_multiindex()

A

Admin • 833.24K Points
Coach

Q. Which function reads a tab-separated file?

  • (A) pd.read_csv(sep='\t')
  • (B) pd.read_tsv()
  • (C) pd.read_table(sep='tab')
  • (D) pd.read_file(sep='\t')

A

Admin • 833.24K Points
Coach

Q. Which parameter is used in `fillna()` to forward fill values?

  • (A) method='ffill'
  • (B) fill='forward'
  • (C) type='carry'
  • (D) direction='down'

A

Admin • 833.24K Points
Coach

Q. How do you access a value at row 0, column 'A'?

  • (A) df.loc[0, 'A']
  • (B) df['A'][0]
  • (C) df.iloc[0]['A']
  • (D) All of the above

A

Admin • 833.24K Points
Coach

Q. What is the result of `df[df['col'].isnull()]`?

  • (A) DataFrame with null values in 'col'
  • (B) Null rows removed
  • (C) Column with filled values
  • (D) Only NaN values in all columns

A

Admin • 833.24K Points
Coach

Q. Which method helps in changing the shape of a DataFrame from wide to long format?

  • (A) melt()
  • (B) pivot()
  • (C) flatten()
  • (D) reshape()

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