1. Learn
  2. /
  3. Courses
  4. /
  5. Sampling in Python

Exercise

Simple sampling with pandas

Throughout this chapter, you'll be exploring song data from Spotify. Each row of this population dataset represents a song, and there are over 40,000 rows. Columns include the song name, the artists who performed it, the release year, and attributes of the song like its duration, tempo, and danceability. You'll start by looking at the durations.

Your first task is to sample the Spotify dataset and compare the mean duration of the population with the sample.

spotify_population is available and pandas is loaded as pd.

Instructions 1/2

undefined XP
    1
    2
  • Sample 1000 rows from spotify_population, assigning to spotify_sample.