Q. Given a Series object s5. Write a program to calculate the cubes of the Series values.


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)
print("Cubes of s5 values:")
print (s5 ** 3)


Output :-

Series object s5:
I    200
K    100
J    500
L    300
M    400
dtype: int64
Cubes of s5 values:
I      8000000
K      1000000
J    125000000
L     27000000
M     64000000
dtype: int64

>>>

Post a Comment

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

Previous Post Next Post