Skip to content

Commit 7bc96c0

Browse files
Update pandas-charts.py
1 parent 9dcee1e commit 7bc96c0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas-charts.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
plt.title('Average Salaries per Department')
5858
plt.xlabel('Department')
5959
plt.ylabel('Average Salary')
60+
output_file = "avg_salary.png"
61+
plt.savefig(output_file, bbox_inches='tight', dpi=300)
6062
plt.show()
6163

6264
# Average Bonus by Department
@@ -72,6 +74,8 @@
7274
plt.title('Average Bonus per Department')
7375
plt.xlabel('Department')
7476
plt.ylabel('Average Bonus')
77+
output_file = "avg_bonus.png"
78+
plt.savefig(output_file, bbox_inches='tight', dpi=300)
7579
plt.show()
7680

7781
# Get the mean, median, standard deviation, and other statistics for the salary column in df_employees_salary
@@ -87,6 +91,8 @@
8791
plt.title('Distribution of Salary')
8892
plt.xlabel('Salary')
8993
plt.ylabel('Count')
94+
output_file = "dist_salary.png"
95+
plt.savefig(output_file, bbox_inches='tight', dpi=300)
9096
plt.show()
9197

9298
# Calculate the correlation matrix between the salary and bonus columns in df_employees_salary
@@ -100,6 +106,8 @@
100106
plt.figure(figsize=(8,6))
101107
sns.heatmap(data=corr_matrix, cmap='coolwarm', annot=True)
102108
plt.title('Correlation Matrix Heatmap')
109+
output_file = "correlation_matrix.png"
110+
plt.savefig(output_file, bbox_inches='tight', dpi=300)
103111
plt.show()
104112

105113
except SQLAlchemyError as e:

0 commit comments

Comments
 (0)