LoslegenKostenlos loslegen

Summertime grooves

In chapter 1, you found that the average danceability of songs has been rising since 2005. Now, you are tasked with finding the average danceability of songs released in different months. Is there some part of the year where more danceable songs are released? If you were a musician who had written a new dance song, is there a best time of year to release that? Let's find out.

Diese Übung ist Teil des Kurses

Parallel Programming with Dask in Python

Kurs anzeigen

Anleitung zur Übung

  • Select the months from the 'release_date' column using its datetime accessor.
  • Select the 'danceability' column and group it by month.
  • Find the mean of the danceability by month.
  • Compute the result.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Extract the months from the release_date column using its datetime accessor 
months = df['____'].____.____

# Group the danceabilities by month
monthly_groupby = df['____'].____(____)

# Find the mean danceability by month
monthly_danceability = ____

# Compute the result
monthly_danceability_result = ____

monthly_danceability_result.plot()
plt.show()
Code bearbeiten und ausführen