4.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)

Output :-