Business Data Analytics – 30 Python Data
Visualization Programs
Load Dataset
import pandas as pd
import [Link] as plt
import seaborn as sns
df = pd.read_excel(r"C:\bda\[Link]")
1. Revenue by Region
[Link]("Region")["Revenue"].sum().plot(kind="bar")
[Link]("Revenue by Region")
[Link]()
2. Revenue by Product
[Link]("Product")["Revenue"].sum().plot(kind="bar")
[Link](rotation=45)
[Link]()
3. Delivery Status Distribution
df["Delivery Status"].value_counts().plot(kind="pie", autopct="%1.1f%%")
[Link]()
4. Payment Status
df["Payment Status"].value_counts().plot(kind="bar")
[Link]()
5. Quantity Sold by Product
[Link]("Product")["Quantity"].sum().plot(kind="bar")
[Link]()
6. Total Profit by Region
[Link]("Region")["Gross Profit"].sum().plot(kind="bar")
[Link]()
7. Top Customers
[Link]("Customer")["Revenue"].sum().sort_values(ascending=False).head(10).plot(kind="bar")
[Link]()
8. Orders by Region
df["Region"].value_counts().plot(kind="bar")
[Link]()
9. Revenue Distribution
[Link](df["Revenue"])
[Link]()
10. Profit Distribution
[Link](df["Gross Profit"])
[Link]()
11. Revenue vs Profit
[Link](df["Revenue"], df["Gross Profit"])
[Link]()
12. Revenue vs Quantity
[Link](df["Quantity"], df["Revenue"])
[Link]()
13. Profit Margin by Product
[Link](x="Product", y="Profit Margin %", data=df)
[Link](rotation=45)
[Link]()
14. Revenue by Payment Status
[Link](x="Payment Status", y="Revenue", data=df)
[Link]()
15. Profit by Delivery Status
[Link](x="Delivery Status", y="Gross Profit", data=df)
[Link]()
16. Region vs Profit Heatmap
pivot = df.pivot_table(values="Gross Profit", index="Region", columns="Product")
[Link](pivot)
[Link]()
17. Revenue Trend by Date
df["Date"] = pd.to_datetime(df["Date"])
[Link]("Date")["Revenue"].sum().plot()
[Link]()
18. Monthly Revenue Trend
[Link](df["Date"].[Link])["Revenue"].sum().plot(marker="o")
[Link]()
19. Quantity Distribution
[Link](df["Quantity"])
[Link]()
20. Profit Margin Distribution
[Link](df["Profit Margin %"])
[Link]()
21. Correlation Heatmap
corr = df[["Revenue","Total Cost","Gross Profit","Profit Margin %"]].corr()
[Link](corr, annot=True)
[Link]()
22. Pair Plot
[Link](df[["Revenue","Total Cost","Gross Profit"]])
[Link]()
23. Revenue by Region & Product
pivot = df.pivot_table(values="Revenue", index="Region", columns="Product")
[Link](kind="bar", stacked=True)
[Link]()
24. Profit by Region Pie Chart
[Link]("Region")["Gross Profit"].sum().plot(kind="pie", autopct="%1.1f%%")
[Link]()
25. Top 5 Products by Profit
[Link]("Product")["Gross Profit"].sum().sort_values(ascending=False).head().plot(kind="bar")
[Link]()
26. Customer Revenue Distribution
[Link](y=df["Revenue"])
[Link]()
27. Revenue vs Cost
[Link](df["Total Cost"], df["Revenue"])
[Link]()
28. Profit Margin vs Revenue
[Link](df["Profit Margin %"], df["Revenue"])
[Link]()
29. Revenue by Region (Horizontal)
[Link]("Region")["Revenue"].sum().plot(kind="barh")
[Link]()
30. Multi■Chart Dashboard
[Link](figsize=(12,10))
[Link](2,2,1)
[Link]("Region")["Revenue"].sum().plot(kind="bar")
[Link]("Revenue by Region")
[Link](2,2,2)
[Link]("Product")["Revenue"].sum().plot(kind="bar")
[Link]("Revenue by Product")
[Link](2,2,3)
df["Delivery Status"].value_counts().plot(kind="pie", autopct="%1.1f%%")
[Link](2,2,4)
[Link]("Customer")["Revenue"].sum().sort_values(ascending=False).head().plot(kind="bar")
plt.tight_layout()
[Link]()