πŸ“Š Pandas
Q. Which of the following is used to create a Series in pandas?
  • (A) pd.Series()
  • (B) pd.DataFrame()
  • (C) pd.array()
  • (D) pd.list()
πŸ’¬ Discuss
βœ… Correct Answer: (A) pd.Series()

Explanation: A pandas Series is a one-dimensional labeled array, created using pd.Series().

πŸ“Š Pandas
Q. Which function is used to read a CSV file into a pandas DataFrame?
  • (A) pd.read_excel()
  • (B) pd.read_csv()
  • (C) pd.read_sql()
  • (D) pd.read_html()
πŸ’¬ Discuss
βœ… Correct Answer: (B) pd.read_csv()

Explanation: The pd.read_csv() function reads a CSV file into a pandas DataFrame.

πŸ“Š Pandas
Q. Which method is used to get the first n rows of a DataFrame?
  • (A) head()
  • (B) tail()
  • (C) first()
  • (D) sample()
πŸ’¬ Discuss
βœ… Correct Answer: (A) head()

Explanation: The head(n) method returns the first n rows of a DataFrame.

πŸ“Š Pandas
Q. Which method is used to get the last n rows of a DataFrame?
  • (A) head()
  • (B) tail()
  • (C) last()
  • (D) sample()
πŸ’¬ Discuss
βœ… Correct Answer: (B) tail()

Explanation: The tail(n) method returns the last n rows of a DataFrame.

πŸ“Š Pandas
Q. What does the pandas function pd.concat() do?
  • (A) Concatenates Series or DataFrames
  • (B) Converts DataFrame to CSV
  • (C) Filters DataFrame rows
  • (D) Renames DataFrame columns
πŸ’¬ Discuss
βœ… Correct Answer: (A) Concatenates Series or DataFrames

Explanation: pd.concat() is used to combine pandas Series or DataFrames along a particular axis.

πŸ“Š Pandas
Q. Which of the following is used to select a column in a pandas DataFrame?
  • (A) df.column_name
  • (B) df['column_name']
  • (C) Both A and B
  • (D) df.select_column()
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both A and B

Explanation: You can select a column using dot notation (df.column_name) or dictionary-style indexing (df['column_name']).

πŸ“Š Pandas
Q. Which method is used to remove missing values in pandas?
  • (A) dropna()
  • (B) fillna()
  • (C) replace()
  • (D) isna()
πŸ’¬ Discuss
βœ… Correct Answer: (A) dropna()

Explanation: The dropna() method removes rows or columns with missing values from a DataFrame.

πŸ“Š Pandas
Q. Which method is used to fill missing values in pandas?
  • (A) dropna()
  • (B) fillna()
  • (C) replace()
  • (D) isna()
πŸ’¬ Discuss
βœ… Correct Answer: (B) fillna()

Explanation: The fillna() method replaces NaN values with a specified value.

πŸ“Š Pandas
Q. What is the difference between loc and iloc in pandas?
  • (A) loc selects rows by index labels, iloc by integer position
  • (B) loc selects columns only, iloc selects rows only
  • (C) loc and iloc are identical
  • (D) loc selects integer positions, iloc selects labels
πŸ’¬ Discuss
βœ… Correct Answer: (A) loc selects rows by index labels, iloc by integer position

Explanation: loc uses labels for selection, while iloc uses integer-based indexing.

πŸ“Š Pandas
Q. Which method is used to get summary statistics of a DataFrame?
  • (A) describe()
  • (B) info()
  • (C) head()
  • (D) tail()
πŸ’¬ Discuss
βœ… Correct Answer: (A) describe()

Explanation: The describe() method provides summary statistics such as mean, standard deviation, min, and max for numerical columns.