Home »
Python »
Python Pandas MCQs
What will be output of following code –? Pandas Question 6
17. What will be output of following code –?
import pandas as pd
S1=pd.Series([100,200,300,400,500],index=['A','B','C','D','E'])
S2=pd.Series([1,2,3,4,5],index=['A','B','C','D','E'])
print(S1*S2)
-
A 10
B 40
C 90
D 160
E 250
dtype: int64
-
A 100
B 400
C 900
D 1600
E 2500
dtype: int64
-
A 1000
B 4000
C 9000
D 16000
E 25000
dtype: int64
-
A 100
B 4000
C 900
D 16000
E 2500
dtype: int64
Answer: B)
A 100
B 400
C 900
D 1600
E 2500
dtype: int64
Explanation:
In the above code, we have taken a series of numbers of 100,200,300,400,500 and index value like 'A','B','C','D','E'. In the next line of code, Series of numbers is 1,2,3,4,5 and index value is 'A','B','C','D','E'. In the third line of code, we are multiplying series 1and series 2 so the outcome of the program will be multiplication of series numbers.