Add: "Average Song Length by Genre" to music stats
This commit is contained in:
parent
163acc22f4
commit
d3c7428bf2
1 changed files with 8 additions and 0 deletions
|
@ -64,3 +64,11 @@ plt.title('Genre Distribution')
|
||||||
plt.ylabel('')
|
plt.ylabel('')
|
||||||
plt.show()
|
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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue