Create a dataframe quarterly sales where each row contain category item name and expenditure display the rows grp by category and also print total expenditure in each category
Answers
Answered by
7
Answer:
import pandas as pd
data={'Category':['Medical','Grocerry','Clothes'],'Item Name':['Sanitizer','Sugar','Tshirt'],'Expenditure':[1000,500,5200]}
quarterly_sales=pd.DataFrame(data)
print(quarterly_sales)
c=quarterly_sales.groupby('Category')
print('Result after filtering')
print(c['Category','Expenditure'].sum())
Explanation:
Attachments:
Answered by
1
Answer:
c=Quarterly_Sales.groupby('Item Category')
print(c.sum())
Similar questions