Python Pandas MCQ Questions And Answers
This section focuses on "Python Pandas" for Data Science. These Python Pandas Multiple Choice Questions (MCQ) should be practiced to improve the Data Science skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. Pandas is an open-source _______ Library?
Explanation: Pandas is an open-source Python Library providing high-performance data manipulation and analysis tool using its powerful data structures.
2. Pandas key data structure is called?
Explanation: Pandas is built on the Numpy package and its key data structure is called the DataFrame.
3. In pandas, Index values must be?
Explanation: Index values must be unique and hashable, same length as data. Default np.arrange(n) if no index is passed.
4. Which of the following is correct Features of DataFrame?
Explanation: All the above are feature of dataframe.
5. A panel is a ___ container of data
Explanation: A panel is a 3D container of data. The term Panel data is derived from econometrics and is partially responsible for the name pandas : pan(el)-da(ta)-s.
6. Which of the following is true?
Explanation: Both option A and B are true.
7. Which of the following takes a dict of dicts or a dict of array-like sequences and returns a DataFrame?
Explanation: DataFrame.from_dict operates like the DataFrame constructor except for the orient parameter which is 'columns' by default.
8. Which of the following makes use of pandas and returns data in a series or dataFrame?
Explanation: freedapi module requires a FRED API key that you can obtain for free on the FRED website.
9. What will be output for the following code?
import pandas as pd
import numpy as np
s = pd.Series(np.random.randn(4))
Explanation: Returns the number of dimensions of the object. By definition, a Series is a 1D data structure, so it returns 1.
10. Which of the following indexing capabilities is used as a concise means of selecting data from a pandas object?
Explanation: ix and reindex are 100% equivalent.