Q. Given a Series object s5. Write a program to store the squares of the Series values in object s6. Display s6's values which are > 15.


Answer :-


import pandas as pd
s5 = pd. Series (data = [200, 100, 500, 300, 400], index= ['I', 'K', 'J', 'L', 'M'])
print("Series object s5 :")
print (s5)
s6 = s5 * 2
print("Values in s6 > 15 :")
print (s6[ s6>15])


Output :-

Series object s5 :
I    200
K    100
J    500
L    300
M    400
dtype: int64
Values in s6 > 15 :
I     400
K     200
J    1000
L     600
M     800
dtype: int64

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post