Question 1: What is Pandas primarily used for in Python?
A. Web development
B. Data analysis and manipulation
C. Game development
D. Network programming
Answer: B
Explanation: Pandas is a popular library designed for data analysis and manipulation, offering flexible
data structures such as DataFrame and Series.
Question 2: Which of the following is a core data structure in Pandas?
A. List
B. Dictionary
C. DataFrame
D. Tuple
Answer: C
Explanation: The DataFrame is one of the central data structures in Pandas, allowing for two-
dimensional labeled data manipulation.
Question 3: Which Pandas function is used to read a CSV file?
A. pd.load_csv()
B. pd.read_csv()
C. pd.import_csv()
D. pd.open_csv()
Answer: B
Explanation: The pd.read_csv() function is the standard way to load CSV files into a DataFrame in
Pandas.
Question 4: What does the Pandas Series represent?
A. A two-dimensional data structure
B. A mutable list of Python objects
C. A one-dimensional labeled array
D. An immutable tuple
Answer: C
Explanation: A Series is a one-dimensional labeled array capable of holding any data type.
Question 5: How do you install Pandas using pip?
A. pip install pandas
B. pip get pandas
C. pip download pandas
D. pip update pandas
Answer: A
Explanation: The command “pip install pandas” installs the Pandas library from the Python Package
Index.
,Question 6: Which method would you use to view the first few rows of a DataFrame?
A. df.head()
B. df.start()
C. df.begin()
D. df.preview()
Answer: A
Explanation: The head() method returns the first five rows by default, making it useful for initial data
exploration.
Question 7: What type of indexing does a Pandas DataFrame use by default?
A. Numeric indexing starting at 0
B. Alphabetic indexing
C. Date-based indexing
D. Random indexing
Answer: A
Explanation: By default, a DataFrame uses numeric indexing starting at 0, although custom indexes can
be defined.
Question 8: Which function provides a quick summary of a DataFrame’s structure?
A. df.structure()
B. df.describe()
C. df.info()
D. df.summary()
Answer: C
Explanation: The info() method gives details about the DataFrame such as the data types and non-null
counts.
Question 9: Which of these is not a feature of Pandas?
A. Data alignment
B. Time series functionality
C. High-performance in-memory join operations
D. Built-in machine learning models
Answer: D
Explanation: Pandas does not provide built-in machine learning models; it focuses on data manipulation
and analysis.
Question 10: What is the importance of Pandas in data analysis?
A. It provides machine learning algorithms.
B. It allows for easy data cleaning, transformation, and analysis.
C. It replaces the need for SQL databases.
D. It is used for web scraping.
Answer: B
Explanation: Pandas is essential because it simplifies the process of cleaning, transforming, and
analyzing data.
Question 11: How do you create a Series from a list in Pandas?
A. pd.Series(list_data)
,B. pd.DataFrame(list_data)
C. pd.create_series(list_data)
D. pd.array(list_data)
Answer: A
Explanation: The pd.Series() function converts a list into a Pandas Series.
Question 12: Which operator is commonly used for element-wise arithmetic operations on a Series?
A. +
B. -
C. *
D. All of the above
Answer: D
Explanation: All these arithmetic operators work element-wise on a Pandas Series.
Question 13: What method is used to check for missing values in a DataFrame?
A. df.checknull()
B. df.isnull()
C. df.missing()
D. df.findna()
Answer: B
Explanation: The isnull() method identifies missing (NaN) values in a DataFrame.
Question 14: How can you select a specific row in a DataFrame by its label?
A. df[5]
B. df.loc['row_label']
C. df.iloc[5]
D. df.row('row_label')
Answer: B
Explanation: The loc[] indexer selects data by label, making it ideal for row selection when labels are
known.
Question 15: What is hierarchical (MultiIndex) indexing used for in Pandas?
A. To index data with multiple levels of labels
B. To create more columns
C. To merge multiple DataFrames
D. To perform arithmetic operations
Answer: A
Explanation: MultiIndexing enables the use of multiple index levels, which is useful for higher-
dimensional data.
Question 16: Which function can be used for slicing rows in a DataFrame by integer location?
A. df.loc[]
B. df.iloc[]
C. df.slice[]
D. df.index()
Answer: B
Explanation: The iloc[] indexer is used to select data by integer-location based indexing.
, Question 17: How would you remove duplicate rows from a DataFrame?
A. df.drop_duplicates()
B. df.remove_duplicates()
C. df.unique_rows()
D. df.drop_duplicates_rows()
Answer: A
Explanation: The drop_duplicates() function removes duplicate rows from a DataFrame.
Question 18: What does the DataFrame’s pivot() method do?
A. Sorts data alphabetically
B. Changes the shape of data by reorganizing rows and columns
C. Filters out missing values
D. Merges two DataFrames
Answer: B
Explanation: The pivot() method rearranges data, converting unique values from one column into
multiple columns.
Question 19: Which file format is not natively supported for reading by Pandas?
A. CSV
B. Excel
C. JSON
D. DOCX
Answer: D
Explanation: Pandas does not have built-in support for reading DOCX files.
Question 20: What parameter in pd.read_csv() is used to specify the delimiter?
A. sep
B. delimiter
C. split
D. token
Answer: A
Explanation: The “sep” parameter in pd.read_csv() defines the delimiter used in the file.
Question 21: How do you write a DataFrame to an Excel file?
A. df.to_excel()
B. df.write_excel()
C. pd.to_excel(df)
D. df.export_excel()
Answer: A
Explanation: The to_excel() method is provided by Pandas for writing DataFrames to Excel files.
Question 22: Which method would you use to view summary statistics of a DataFrame?
A. df.describe()
B. df.summary()
C. df.stats()
D. df.analyze()
Answer: A