40+ most important Pandas mcq questions and answers

mcq questions on pandas, multiple choice questions on pandas, mcq questions on python pandas class 12, pandas exercises mcqs, pandas dataframe mcq, python pandas mcq, pandas mcq questions, python pandas mcq, python pandas mcq questions and answers, python pandas multiple choice questions, python pandas series mcq,
Pandas mcq

Pandas is one of the most popular python library. Pandas is highly used for various data engineering tasks. Following are the python pandas mcq questions to help you better understand the pandas module. These Python Pandas multiple choice questions are both theory based and practical based so you will gain a significant amount of Hands-on knowledge from the given pandas exercises mcqs. We are also trying to put Pandas mcq pdf download link to get pandas mcq questions for free.

Python Pandas mcq questions with answers

Q.31. We can imagine a Pandas Series as a ______________ in a spreadsheet

a. Column
b. Cell
c. Table
d. None of the above

Advertisement

Column

Q.32. We can assign user-defined labels to the index of the series?(T/F)
a. True
b. False
Show Answer

Advertisement

True

Q.33. Write the output of the following :
import pandas as pd
series2 = pd.Series([“Kavi”,”Shyam”,”Ravi”], index=[3,5,1])
print(series2 > “S”)

a.
3 False
5 False
1 False
dtype: bool
b.
3 False
5 True
1 False
dtype: bool
c.
3 True
5 True
1 True
dtype: bool
d. None of the above

Advertisement

b. 3 False 5 True 1 False dtype: bool

Q.34. Which of the following statement is correct for importing pandas in python?
a. import pandas
b. import pandas as pd
c. import pandas as pds
d. All of the above

Advertisement

All of the above

Q.35. What type of error is returned by following statement?
import pandas as pnd
pnd.Series([1,2,3,4], index = [‘a’,’b’,’c’])

a. SyntaxError
b. IndexError
c. ValueError
d. None of the above

ValueError

Q.36. Which attribute is used to give user defined labels in Series?
a. index
b. data
c. values
d. None of the above

Advertisement

index

Q.37. Fill in the blank to get the ouput as 3
import pandas as pnd
S1=pnd.Series([1,2,3,4], index = [‘a’,’b’,’c’,’d’])
print(S1[_])

a. ‘c’
b. 2
c. c
d. Both a and b

Advertisement

Both a and b

Q.38. Write the statement to get NewDelhi as output using positional index.
import pandas as pd
S1 = pd.Series([‘NewDelhi’, ‘WashingtonDC’, ‘London’, ‘Paris’],
index=[‘India’, ‘USA’, ‘UK’, ‘France’])

a. print(S1[0])
b. print(S1[‘India’])
c. Both a and b
d. print(S1.India)

Both a and b

Q.39. We can access elements in Series by using ________ index and ____________index.
a. Numeric, labelled
b. Positional, Naming
c. Positional, labelled
d. None of the above

Positional, labelled

Q.40. Write the output of the following :


import pandas as pd
S1 = pd.Series([‘NewDelhi’, ‘WashingtonDC’, ‘London’, ‘Paris’],
index=[‘India’, ‘USA’, ‘UK’, ‘France’])
print(S1[‘India’, ‘UK’])

a.
India NewDelhi
UK London
dtype: object
b.
India NewDelhi
UK Washington
dtype: object
c. Error
d. None of the above

Advertisement

Error

Pandas mcq questions and answers

Q.41. Which of the following statement will print Series ‘S1’ in reverse order?
a. print(S1[: : 1]
b. print(S1[: : -1]
c. print(S1[-1: : 1]
d. print(S1.reverse( ))

Advertisement

print(S1[ : : -1]

Q.42. How many values will be modified by last statement of given code ?
import pandas as pd
S1 = pd.Series([‘NewDelhi’, ‘WashingtonDC’, ‘London’, ‘Paris’],
index=[‘A’, ‘B’, ‘C’, ‘D’])
S1[‘A’ : ‘C’] = ‘ND’

a. 1
b. 2
c. 3
d. 4
Answer

3

Q.43. How many values will be modified by last statement of given code ?
import pandas as pd
S1 = pd.Series([‘NewDelhi’, ‘WashingtonDC’, ‘London’, ‘Paris’],
index=[‘A’, ‘B’, ‘C’, ‘D’])
S1[1 : 3] = ‘ND’

a. 1
b. 2
c. 3
d. 4
Answer

2

Q.44. Which of the following property/attribute assign name to the Series?
a. name
b. index.name
c. size
d. Series.name

Advertisement

name

Q.45. S1.values will return all the values of Series ‘S1’ in _________
a. Tuple
b. Dictionary
c. List
d. String
er

Advertisement

List

Q.46. Which of the following property/attribute return total number of values in Series ‘S1’?
a. size
b. values
c. index
d. None of the above

size

Q.47. Which of the following attributes returns True if there is no value in Series?
a. index
b. size
c. empty
d. values
er

Advertisement

empty

Q.48. Which of the following attributes returns all the values of Series?
a. size
b. index
c. name
d. values
er

Advertisement

values

Q.49. Write the output of the following code:
import pandas as pd
S1=pd.Series()
print(pd.Series().empty)

a. True
b. False
c. Error
d. None of the above

True

Q.50. Write the output of the following code :
import pandas as pd
S1=pd.Series([1,2,3,4])
S2=pd.Series([7,8])
S3=S1+S2
print(S3.size)

a. 2
b. 4
c. 6
d. Error
wer

4

Python Pandas multiple choice questions with answers

Q.51. Which of the following statement shows first five values of Series ‘S1’?
a. S1.head( )
b. S1.head( 5 )
c. Both of the above
d. None of the above

Advertisement

Both of the above

Q.52. Write the output of the following :
import pandas as pd
S1=pd.Series([1,2,3,4])
S2=pd.Series([7,8])
print((S1+S2).count())

a. 6
b. 4
c. 2
d. 0
Answer

2

Q.53. Which of the following returns number of non-NaN values of Series?
a. count
b. size
c. index
d. values
Show Answer

Advertisement

count

Q.54. Write the output of the following :
import pandas as pd
S1=pd.Series([1,2,3,4])
S2=pd.Series([7,8,9,10])
S2.index=[‘a’,’b’,’c’,’d’]
print((S1+S2).count())

a. 8
b. 4
c. 0
d. 6
Answer

0

Q.55. We can perform _____________ on two series in Pandas.
a. Addition
b. Subtraction
c. Multiplication
d. All of the above

Advertisement

All of the above

Q.56. Which of the following method is used to add two series?
a. sum( )
b. addition( )
c. add( )
d. None of the above

Advertisement

add( )

Q.57. Which of the following statement will display the difference of two Series ‘A’ and ‘B’?
a. >>>A – B
b. >>>A.sub(B)
c. Both of the above
d. None of the above

Both a and b above

Q.58. Which of the following fills the missing values in Series?
a. fill value
b. fill-value
c. fill_value
d. fill_value( )

fill_value

Q.59. Which of the following function is used for basic mathematical operations in Series?
a. add( )
b. mul( )
c. div( )
d. All of the above

Advertisement

All of the above

Q.60. Which of the following statement is replacing missing values of Series A and Series B by 100 .
a. >>> A.add(B, fill_value = 100)
b. >>>A.add(B, fill_value : 100)
c. >>> A.add(B, fill-value = 100)
d. >>> A.add(B, fill-value : 100)

>>> A.add(B, fill_value = 100)

Python Pandas mcqs

Q.61. Mathematical Operations on two Series object is done by matching ____________
a. indexes
b. values
c. Both of the above
d. None of the above

indexes

Q.62. Which of the following statement will display values more than 40 from Series ‘S1’?
a. >>>S1
b. >>> S1 > 40
c. >>>S1[S1 > 40]
d. None of the above

Advertisement

>>>S1[S1 > 40]

Q.63. Which of the following statement will return 10 values from the bottom/end of the Series ‘S1’?
a. S1.tail( )
b. S1.tail(10)
c. S1.head(10)
d. S1(10)
er

S1.tail(10)

Q.64. Which of the following are valid operations on Series ‘S1’?
a. >>> S1 + 2
b. >>> S1 ** 2
c. >>> S1 * 2
d. All of the above

All of the above

Q.65. When an operation is carried out on every value of Series object is called _____
a. Scalar Operation
b. Vector Operation
c. Both of the above
d. None of the above

Advertisement

Vector Operation

Q.66. Which of the following statement will modify the first three values of Series ‘S1’?
a. S1[0, 1, 2] = 100
b. S1[0 : 3] = 100
c. S1[ : 3] = 100
d. All of the above

All of the above

Q.67. We can have duplicate indexes in Series?(T/F)
a. True
b. False
Show Answer

True

Q.68. What is the index value of 31 in given Series ‘S1’?
import pandas as pd
S1=pd.Series([1,2,31,4], index = [‘a’,’b’,’c’,’d’])

a. ‘c’
b. 2
c. Both of the above
d. None of the above

Advertisement

Both of the above

Q.69. S2 is ____________ in given code ?
S2 = S1[2 : 5] #S1 is a Series object

a. List
b. Tuple
c. Series
d. None of the above

Series

Q.70. Following two statements will provide the same output.(T/F)
>>>L1 * 2 #L1 is a list
>>>S1 * 2 #S1 is a Series

a. True
b. False
Show Answer

Advertisement

py

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top