
Below are the 50 most important Python Pandas mcqs for online exams and the company interviews. These Pandas multiple choice questions can be asked for various programming test taken by the various companies like Infosys, TCS, Accenture, Capgemini, etc. and lot of others. Pandas mcq are also useful for class 12 pandas. These questions include pandas dataframe mcq, pandas series mcq and pandas fundamental mcq questions. We are also planning to provide you pandas mcq pdf for download.
Q.1. Which of the following are modules/libraries in Python?
a. NumPy
b. Pandas
c. Matplotlib
d. All of the above
All of the above
Q.2. NumPy stands for ____
a. Number Python
b. Numerical Python
c. Numbers in Python
d. None of the above
Numerical Python
Q.3. Which of the following libraries allows to manipulate, transform and visualize data easily and efficiently.
a. Pandas
b. NumPy
c. Matplotlib
d. All of the above
All of the above
Q.4. PANDAS stands for _____________
a. Panel Data Analysis
b. Panel Data analyst
c. Panel Data
d. Panel Dashboard
Panel Data Analysis
Q.5. __________ is an important library used for analyzing data.
a. Math
b. Random
c. Pandas
d. None of the above
Pandas
Q.6. Important data structure of pandas is/are ___________
a. Series
b. DataFrame
c. Both of the above
d. None of the above
Both of the above
Q.7. Which of the following library in Python is used for plotting graphs and visualization.
a. Pandas
b. NumPy
c. Matplotlib
d. None of the above
Matplotlib
Q.8. Pandas Series can have _________________ data types
a. float
b. integer
c. String
d. All of the above
All of the above
Q.9. _________ is used when data is in Tabular Format.
a. NumPy
b. Pandas
c. Matplotlib
d. All of the above
Pandas
Q.10. Which of the following command is used to install pandas?
a. pip install pandas
b. install pandas
c. pip pandas
d. None of the above
pip install pandas
Q.10. Which of the following command is used to import pandas?
a. import pandas as pd
b. import pandas
c. from pandas import *
d. All of above
All of above
Q.12. A _______________ is a one-dimensional array.
a. Data Frame
b. Series
c. Both of the above
d. None of the above
Series
Q.13. Which of the following statement is wrong?
a. We can create Series from Dictionary in Python.
b. Keys of dictionary become index of the series.
c. Order of indexes created from Keys may not be in the same order as typed in dictionary.
d. All are correct
All are correct
Q.14. A Series by default have numeric data labels starting from ______________.
a. 3
b. 2
c. 1
d. 0
Answer
0
Q.15. The data label associated with a particular value of Series is called its ______________
a. Data value
b. Index
c. Value
d. None of the above
Index
Q.16. Which of the following module is to be imported to create Series?
a. NumPy
b. Pandas
c. Matplotlib
d. None of the above
Pandas
Q.17. Which of the following function/method help to create Series?
a. series( )
b. Series( )
c. createSeries( )
d. None of the above
Series( )
Q.18. Write the output of the following :
>>> import pandas as pd
>>> series1 = pd.Series([10,20,30])
>>> print(series1)
a.
Output:
0 10
1 20
2 30
dtype: int64
b.
Output:
10
20
30
dtype: int64
c.
Output:
0
1
2
dtype: int64
d. None of the above
a. 0 10 1 20 2 30 dtype: int64
Q.19. When you print/display any series then the left most column is showing _________ value.
a. Index
b. Data
c. Value
d. None of the above
Index
Q.20. How many values will be there in array1, if given code is not returning any error?
>>> series4 = pd.Series(array1, index = [“Jan”, “Feb”, “Mar”, “Apr”])
a. 1
b. 2
c. 3
d. 4
Answer
4
Pandas Series mcq questions and answers
Q.21. Which of the following statement will create an empty series named “S1”?
a. S1 = pd.Series(None)
b. S1 = pd.Series( )
c. Both of the above
d. None of the above
Both of the above
Q.22. How many elements will be there in the series named “S1”?
>>> S1 = pd.Series(range(5))
>>> print(S1)
a. 5
b. 4
c. 6
d. None of the above
5
Q.23. When we create a series from dictionary then the keys of dictionary become ________________
a. Index of the series
b. Value of the series
c. Caption of the series
d. None of the series
Index of the series
Q.24. Write the output of the following :
>>> S1=pd.Series(14, index = [‘a’, ‘b’, ‘c’])
>>> print(S1)
a.
a 14
b 14
c 14
dtype: int64
b.
a 14
dtype: int64
c. Error
d. None of the above
a. a 14 b 14 c 14 dtype: int64
Q.25. Write the output of the following:
>>> S1=pd.Series(14, 7, index = [‘a’, ‘b’, ‘c’])
>>> print(S1)
a.
a 14
b 7
c 7
dtype: int64
b.
a 14
b 7
dtype: int64
c. Error
d. None of the above
Error
Q.26. Write the output of the following :
>>> S1=pd.Series([14, 7, 9] ,index = range(1, 8, 3))
>>> print(S1)
a.
14 1
7 4
9 7
dtype: int64
b.
1 14
4 7
7 9
dtype: int64
c. Error
d. None of the above
b. 1 14 4 7 7 9 dtype: int64
Q.27. Which of the following code will generate the following output?
Jan 31
Feb 28
Mar 31
dtype: int64
a.
import pandas as pd
S1 = pd.Series(data = [31,28,31], index=[“Jan”,”Feb”,”Mar”])
print(S1)
b.
import pandas as pd
S1 = pd.Series([31,28,31], index=[“Jan”,”Feb”,”Mar”])
print(S1)
c. Both of the above
d. None of the above
Both of the above
Q.28. Write the output of the following:
import pandas as pd
S1 = pd.Series(data = range(31, 2, -6), index = [x for x in “aeiou” ])
print(S1)
a.
a 31
e 25
i 19
o 13
u 7
dtype: int64
b.
a 31
e 25
i 19
o 13
dtype: int64
c. Error
d. None of the above
a. a 31 e 25 i 19 o 13 u 7 dtype: int64
Q.29. What type of error is returned by following code?
import pandas as pd
S1 = pd.Series(data = (31, 2, -6), index = [7, 9, 3, 2])
print(S1)
a. SyntaxError
b. IndexError
c. ValueError
d. None of the above
ValueError
Q.30. Write the output of the following :
import pandas as pd
S1 = pd.Series(data = 2*(31, 2, -6))
print(S1)
a.
0 31
1 2
2 -6
dtype: int64
b.
0 31
1 2
2 -6
3 31
4 2
dtype: int64
c.
0 31
1 2
2 -6
3 31
dtype: int64
d.
0 31
1 2
2 -6
3 31
4 2
5 -6
dtype: int64
Show Answer
d. 0 31 1 2 2 -6 3 31 4 2 5 -6 dtype: int64
Q.1. Pandas is an open-source _______ Library?
A. Ruby
B. Javascript
C. Java
D. Python
Python
Q.2. Pandas key data structure is called?
A. Keyframe
B. DataFrame
C. Statistics
D. Econometrics
DataFrame
Q.3. In pandas, Index values must be?
A. unique
B. hashable
C. Both A and B
D. None of the above
Both A and B
Q.4. Which of the following is correct Features of DataFrame?
A. Potentially columns are of different types
B. Can Perform Arithmetic operations on rows and columns
C. Labeled axes (rows and columns)
D. All of the above
All of the above
Q.5. A panel is a ___ container of data
A. 1D
B. 2D
C. 3D
D. Infinite
3D
Q.6. Which of the following is true?
A. If data is an ndarray, index must be the same length as data.
B. Series is a one-dimensional labeled array capable of holding any data type.
C. Both A and B
D. None of the above
Both A and B
Q.7. Which of the following takes a dict of dicts or a dict of array-like sequences and returns a DataFrame?
A. DataFrame.from_items
B. DataFrame.from_records
C. DataFrame.from_dict
D. All of the above
DataFrame.from_items
Q.8. Which of the following makes use of pandas and returns data in a series or dataFrame?
A. pandaSDMX
B. freedapi
C. OutPy
D. Inpy
swer
freedapi
Q.9. What will be output for the following code?
import pandas as pd
import numpy as np
s = pd.Series(np.random.randn(4))
print(s.ndim)
A. 0
B. 1
C. 2
D. 3
Answer
1
Q.10. Which of the following indexing capabilities is used as a concise means of selecting data from a pandas object?
A. In
B. ix
C. ipy
D. iy
Answer
ix
Q.11. Python pandas was developed by?
A. Guido van Rossum
B. Travis Oliphant
C. Wes McKinney
D. Brendan Eich
Wes McKinney
Q.12. What will be output for the following code?
import pandas as pd
s = pd.Series([1,2,3,4,5],index = [‘a’,’b’,’c’,’d’,’e’])
print(s[‘a’])
A. 1
B. 2
C. 3
D. 4
Answer
1
Q.13. What will be correct syntax for pandas series?
A. pandas_Series( data, index, dtype, copy)
B. pandas.Series( data, index, dtype)
C. pandas.Series( data, index, dtype, copy)
D. pandas_Series( data, index, dtype)
pandas.Series( data, index, dtype, copy)
Q.14. What will be syntax for pandas dataframe?
A. pandas.DataFrame( data, index, dtype, copy)
B. pandas.DataFrame( data, index, rows, dtype, copy)
C. pandas_DataFrame( data, index, columns, dtype, copy)
D. pandas.DataFrame( data, index, columns, dtype, copy)
pandas.DataFrame( data, index, columns, dtype, copy)
Q.15. Axis 1, in panel represent?
A. minor_axis
B. major_axis
C. items
D. None of the above
major_axis
Q.16. Which of the following thing can be data in Pandas?
A. a python dict
B. an ndarray
C. a scalar value
D. All of the above
All of the above
Q.17. The ________ project builds on top of pandas and matplotlib to provide easy plotting of data.
A. yhat
B. Seaborn
C. Vincent
D. Pychart
Seaborn
Q.18. Why ndim is used?
A. Returns the number of elements in the underlying data.
B. Returns the Series as ndarray.
C. Returns the number of dimensions of the underlying data, by definition 1.
D. Returns a list of the axis labels
Returns the number of dimensions of the underlying data, by definition 1.
Q.19. What will be output for the following code?
import pandas as pd
import numpy as np
s = pd.Series(np.random.randn(2))
print(s.size)
A. 0
B. 1
C. 2
D. 3
2
Q.20. Which of the following is false?
A. The integer format tracks only the locations and sizes of blocks of data.
B. Pandas follow the NumPy convention of raising an error when you try to convert something to a bool.
C. Two kinds of SparseIndex are implemented
D. The integer format keeps an arrays of all of the locations where the data are not equal to the fill value
The integer format tracks only the locations and sizes of blocks of data.