CPSC 203, 2025 W1
October 7, 2025
Warm Up – datetime again
Exploring pandas:
datetime: a Python library that simplifies date computation.
Objects we need
date — a calendar day (year-month-day)timedelta — a number of days you can add/subtractCore calls
today=date.today(): today’s datetoday.weekday(): an integer 0..6 with Mon=0, … , Sun=6today - timedelta(days=k): the date k days earlierGiven last week’s chart:
How many new songs were there?
What’s the average peak?
Among those who were on the list for more than 10wk, what’s the average peak? (Is it very different than the previous answer?)
Which song changed the most? Was it rising or falling?
Write and answer your own question:
_____________________________________________________
Open CA5.2 Billboard, and load class_nb.py.
Which song moved the most? Did it rise or fall?
| C | C | C | C | C | C |
|---|---|---|---|---|---|
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
| C | C | C | C | C | C |
https://pymotw.com/2/datetime/
https://www.dataschool.io/best-python-pandas-resources/
https://pandas.pydata.org/Pandas_Cheat_Sheet.pdf
https://queirozf.com/entries/pandas-dataframe-plot-examples-with-matplotlib-pyplot