Skip to content

Instantly share code, notes, and snippets.

@dottyz
Created May 2, 2019 18:38
Show Gist options
  • Save dottyz/227a706785becc31a51485623019c64d to your computer and use it in GitHub Desktop.
Save dottyz/227a706785becc31a51485623019c64d to your computer and use it in GitHub Desktop.
# Aggregate the ridership by date fields and user type and count the number of unique trips
ridership = df.groupby(['Date', 'Quarter', 'Month', 'Day of Week', 'User Type'])['Id']\
.nunique().reset_index().sort_values('User Type', ascending=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment