Solution :-
import pandas as pd #Creating DataFrame
d = {2018:[110,130,115,118],
2019:[205,165,175,190],
2020:[115,206,157,179],
2021:[118,198,183,169]}
sales=pd.DataFrame(d,index=[‘Kapil’,’Kamini’,’Shikhar’,’Mohini’])
print(“Transpose:”)
print(“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”)
print(sales.T)
print(“\nSales made by each salesman in 2018”)
#Method 1 print(sales[2018])
#Method 2 print(sales.loc[:,2018])
print(“Sales made by Kapil and Mohini:”) #Method 1
print(sales.loc[[‘Kapil’,’Mohini’], [2019,2020]])
#Method 3 print(sales.loc[sales.index.isin([“Kapil”,”Mohini”]),[2019,2020]])
print(“Add Data:”)
sales.loc[“Nirali”]=[221, 178, 165, 177]
print(sales)
print(“Delete Data for 2018:”)
sales=sales.drop(columns=2018)
print(sales)
Sales.drop(columns=2018,inplace=True)
print(Sales)
sales=sales.drop(“Shikhar”,axis=0) #sales.drop(“kinshuk”)
print(sales)
sales=sales.rename({“Kamini”:”Rani”,”Kapil”:”Anil”},axis=”inde x”)
print(sales)
sales.loc[sales.index==”Mohini”,2018]=150
print(sales)