1
0
Fork 0

Add: "Average Song Length by Genre" to music stats

This commit is contained in:
Aroy-Art 2024-09-25 22:20:36 +02:00
parent 163acc22f4
commit d3c7428bf2
Signed by: Aroy
GPG key ID: DB9689E9391DD156

View file

@ -64,3 +64,11 @@ plt.title('Genre Distribution')
plt.ylabel('')
plt.show()
avg_length_by_genre = df.groupby('genre')['length'].mean().sort_values()
plt.figure(figsize=(10, 6))
sns.barplot(x=avg_length_by_genre.values, y=avg_length_by_genre.index)
plt.title('Average Song Length by Genre')
plt.xlabel('Average Length (seconds)')
plt.show()