Skip to content

Instantly share code, notes, and snippets.

@gonzalezgouveia
Last active November 26, 2018 15:27
Show Gist options
  • Save gonzalezgouveia/6ef8464b8d161dbec41aff9e20526ee1 to your computer and use it in GitHub Desktop.
Save gonzalezgouveia/6ef8464b8d161dbec41aff9e20526ee1 to your computer and use it in GitHub Desktop.
ecobici data aggregation
# resample y agregacion por dia de mes
viajes_resample_day = viajes.Bici.resample('H').count()
# asignar día de la semana
df_resample = pd.concat([viajes_resample_day], axis=1)
df_resample['dayofweek'] = df_resample.index.dayofweek # 0 es lunes
# lunes a viernes
df_mon_to_fri = df_resample[df_resample.dayofweek.isin([0,1,2,3,4])].Bici
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment