Q. Create the following DataFrame Sales containing year wise sales figures for five sales persons in INR. Use the years as column labels, and sales person names as row labels.

 
2014 2015 2016 2017
Madhu 100.5 12000 20000 50000
Kusum 150.8 18000 50000 60000
Kinshuk 200.9 22000 70000 70000
Ankit 30000 30000 100000 80000
Shruti 40000 45000 125000 90000

Answer:-

import pandas as pd
inr2014=[100.5, 150.8, 200.9, 30000, 40000]
inr2015=[12000, 18000, 22000, 3000, 45000]
inr2016=[20000, 50000, 70000, 100000, 125000]
inr2017=[50000, 60000, 70000, 80000, 90000]

label=['Madhu','Kusum','Kinshuk','Ankit','Shruti']
dic={'2014':inr2014,'2015':inr2015,'2016':inr2016,'2017':inr2017}
Sales  = pd.DataFrame(dic,index=label)
print(Sales)

Output:- 

            2014   2015    2016   2017
Madhu      100.5  12000   20000  50000
Kusum      150.8  18000   50000  60000
Kinshuk    200.9  22000   70000  70000
Ankit    30000.0   3000  100000  80000
Shruti   40000.0  45000  125000  90000
>>>


2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post