#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Felix Muzny 12/2/2022 DS 2000 Lecture 23 - timing experiments Logistics: - OH for the rest of the semester - 4 - 8pm - we're happy to help you with DS 2001 projects AND expect to explain your project/goal to the TA a bit to get help to start with :) - remote attendance (https://bit.ly/remote-ds2000-muzny) - Now playing: santé (stromae) Warm-up 0: Do you listen to music on spotify? A. yes B. nope! Dec 1st: wrapped came out summary of your yearly music listening statistics Three ways to participate in multiple choice questions 1) via the PollEverywhere website: https://pollev.com/muzny 2) via text: text "muzny" to the number 22333 to join the session 3) via Poll Everywhere app (available for iOS or Android) """ """ Spotify Wrapped Day --- (slides) 1. how many genres you listened to 2. which were your top genres 3. what kinds of music you listened to at different times of day 4. total play time 5. what song you listened to the most 6. how many songs you listened to and your top five songs 7. your top 100 songs 8. how many artists you listened to 9. what your top artist was (by minutes) 10. what percentile of people listening to that artist you are in 11. your top 5 artists 12. your listening personality What data do we need to answer these questions? https://www.spotify.com/us/account/privacy/ - you can request all your streaming data - it take 5 days to get it, but spotify will gather it for you """ """ All your questions! ---- Next Tuesday, we'll be doing a combo lecture of some trivia and an opportunity for you all to ask me anything that you're curious about. Spend a minute filling out the survey here to submit questions: https://bit.ly/ds2000finalday """ # Now playing (the song that Felix listened to 40 times last year) # slå mig hårt i ansiktet (thomas stenström) """ DataFrame warm-ups/review ---- Say that I've loaded a data frame in as follows: """ import pandas as pd df = pd.read_csv("movies.csv") print(df) df.info() print() """ what code can you use to find how many rows are in the data frame? """ # (rows, columns) -> tuple (an immutable list) print(df.shape) print(df.shape[0]) print(len(df)) print() """ what code can you use to find how many columns are in the data frame? """ print(df.shape[1]) print() """ what code can you use to find the maximum value in the IMDB column? """ # first fetching the IMDB column, then calc the max print(df["IMDB"].max()) print() """ what code can you use to find the row number of the maximum value in the IMDB column? """ # when you want the thing (normally an index) # associated with the row with the max value # this is called an argmax (or argmin) print(df["IMDB"].argmax()) print() """ what code can you use to find a single specific row? """ # a single set of square brackets is giving # me a Series (pandas 1d data object) # 2 square brackets gets me a DataFrame # (2d data object) print(df.iloc[[0]]) print(df.iloc[[df["IMDB"].argmax()]]) print(df.iloc[[df["IMDB"].argmin()]]) # Next Time # --- # - Ask Felix Anything # - Trivia/Review