Members vs casual riders over time
Riders can either be "Members"
, meaning they pay yearly for the ability to take a bike at any time, or "Casual"
, meaning they pay at the kiosk attached to the bike dock.
Do members and casual riders drop off at the same rate over October to December, or does one drop off faster than the other?
As before, rides
has been loaded for you. You're going to use the Pandas method .value_counts()
, which returns the number of instances of each value in a Series. In this case, the counts of "Member" or "Casual".
Diese Übung ist Teil des Kurses
Working with Dates and Times in Python
Anleitung zur Übung
- Set
monthly_rides
to be a resampled version ofrides
, by month, based on start date. - Use the method
.value_counts()
to find out how many Member and Casual rides there were, and divide them by the total number of rides per month.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Resample rides to be monthly on the basis of Start date
monthly_rides = rides.____(____)['Member type']
# Take the ratio of the .value_counts() over the total number of rides
print(monthly_rides.____() / monthly_rides.size())