WRITE A PROGRAM TO CREATE A DATA SERIES AND THEN CHANGE THE INDEXES OF THE SERIES OBJECT IN ANY RANDOM ORDER

Solution:-

import pandas as pd
import numpy as np
s = pd.Series(data=[1,2,3,4,5,6,7,8],index=[‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’])
print(“Data Series”)
print(s)
s = s.reindex(index=[“B”,”G”,”C”,”F”,”E”,”A”,”H”,”D”])
print(“Data Series after changing the order of Index”)
print(s)