Prgramming MCQs Feed | Page - 4

S

Sikhar Chaudhary • 5.88K Points
Tutor III

Q. Which pandas method is used to create dummy/indicator variables?

  • (A) get_dummies()
  • (B) dummy_vars()
  • (C) to_categorical()
  • (D) one_hot()

S

Sikhar Chaudhary • 5.88K Points
Tutor III

Q. Which method is used to drop a level from a MultiIndex in pandas?

  • (A) unstack()
  • (B) stack()
  • (C) droplevel()
  • (D) remove_level()

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

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

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

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

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

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

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

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

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

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

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

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

S

Sikhar Chaudhary • 5.88K Points
Tutor III

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

Sikhar Chaudhary • 5.88K Points
Tutor III

Q. Which method is used to rename columns in a pandas DataFrame?

  • (A) rename_columns()
  • (B) rename()
  • (C) set_columns()
  • (D) update_columns()