Pandas Pivot Table: Create a Pivot table and find the region wise total sale
5. Region-Wise Total Sale
Write a Pandas program to create a Pivot table and find the region wise total sale. Go to Excel data
Sample Solution:
Python Code :
Sample Output:
Sale_amt Region Central 829769.5 East 321007.0 West 154899.0
Pivot Table:
Salesdata.xlsx:
For more Practice: Solve these Related Problems:
- Write a Pandas program to create a pivot table that computes the total sale amount for each region.
- Write a Pandas program to generate a pivot table with region as the index and sale amount summed for each region.
- Write a Pandas program to build a pivot table from Salesdata.xlsx that aggregates sale totals region-wise and then display the sorted results.
- Write a Pandas program to create a pivot table to summarize the sale amount by region and then highlight regions with the highest sales.
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Pandas program to create a Pivot table and find the item wise unit sold.
Next: Write a Pandas program to create a Pivot table and find the region wise, item wise unit sold.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.