Q. Given a Series object s4. Write a program to change the values at its 2nd row(index1) and 3rd row to 8000.
Answer :-
import pandas as pd s4 = pd. Series (data = [200, 100, 500, 300, 400], index= ['I', 'K', 'J', 'L', 'M']) print("Original Series object s4:") print (s4) s4[1:3]=8000 print("Series object s4 after changing value: ") print (s4)
Output :-
Original Series object s4:
I 200
K 100
J 500
L 300
M 400
dtype: int64
Series object s4 after changing value:
I 200
K 8000
J 8000
L 300
M 400
dtype: int64
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )