Write a Python Program to rename index values in Python.
Answers
Answered by
3
Answer:
Example #1: Use Series.rename() function to rename the name of the given Series object.
# importing pandas as pd
import pandas as pd
# Creating the Series
sr = pd.Series([10, 25, 3, 11, 24, 6])
# Create the Index
index_ = ['Coca Cola', 'Sprite', 'Coke', 'Fanta', 'Dew', 'ThumbsUp']
# set the index
sr.index = index_
# Print the series
print(sr)
Answered by
1
Answer:
Refer to above attachment
Explanation:
Refer to above attachment
Attachments:
Similar questions