How long per weekday?
Pandas has a number of datetime-related attributes within the .dt accessor. Many of them are ones you've encountered before, like .dt.month. Others are convenient and save time compared to standard Python, like .dt.day_name().
Questo esercizio fa parte del corso
Working with Dates and Times in Python
Istruzioni dell'esercizio
- Add a new column to
ridescalled'Ride start weekday', which is the weekday of theStart date. - Print the median ride duration for each weekday.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Add a column for the weekday of the start of the ride
rides['Ride start weekday'] = rides['Start date'].____
# Print the median trip time per weekday
print(rides.____(____)['Duration'].median())