1. Learn
  2. /
  3. Courses
  4. /
  5. Parallel Programming with Dask in Python

Exercise

How danceable are songs these days?

It's time to dive deeper into the Spotify data to analyze some trends in music.

In each CSV file, the 'danceability' column contains the score between 0 and 1 of how danceable each song is. The score describes how suitable a track is for dancing based on a combination of musical elements, including tempo, rhythm stability, beat strength, and overall regularity. Do you think songs are getting better or worse to dance to?

dask and the delayed() function have been imported for you. pandas has been imported as pd, and matplotlib.pyplot has been imported as plt. The list of filenames is available in your environment as filenames, and the year of each file is stored in the years list.

Instructions

100 XP
  • Inside the loop, lazily load in each file.
  • Using the 'danceability' column, find the mean danceability of songs in each file.
  • Compute all of the results in the danceabilities list, and select the first item of the resulting tuple.
  • Make a plot with danceability_list on the y-axis and years on the x-axis using plt.plot().