MulaiMulai sekarang secara gratis

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".

Latihan ini adalah bagian dari kursus

Working with Dates and Times in Python

Lihat Kursus

Petunjuk latihan

  • Set monthly_rides to be a resampled version of rides, 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Resample rides to be monthly on the basis of Start date
monthly_rides = rides.____('____', on = '____')['Member type']

# Take the ratio of the .value_counts() over the total number of rides
print(monthly_rides.____() / monthly_rides.size())
Edit dan Jalankan Kode