13-08(DS)

PHOTO EMBED

Tue Aug 13 2024 09:07:30 GMT+0000 (Coordinated Universal Time)

Saved by @signup

#2. Bar Plot
#used to compare diff categories
#Ex: Bar plot for sales by region
regions=["North","East","West","South"]
sales_by_region = [25000,31000,17000,19000]

plt.bar(regions,sales_by_region,color='yellow')
plt.title("Sales by Region")
plt.xlabel("Regions")
plt.ylabel("Sales($)")
plt.show()
****************************************
import pandas as pd
import seaborn as sns
#7.Heatmap
#Ex: Heatmap of correlations
data={
    'Sales':sales,
    ' Profit':profit,
    'Product Sold':products_sold
}
df=pd.DataFrame(data)
correlation_matrix=df.corr()
sns.heatmap(correlation_matrix,annot=True,cmap='coolwarm')
plt.title("Correlation Heatmap")
plt.show()

content_copyCOPY