Skip to content

Instantly share code, notes, and snippets.

@gonzalezgouveia
Last active November 26, 2018 21:05
Show Gist options
  • Save gonzalezgouveia/3cde5bb4cd9605f88e07c786a64f8cd4 to your computer and use it in GitHub Desktop.
Save gonzalezgouveia/3cde5bb4cd9605f88e07c786a64f8cd4 to your computer and use it in GitHub Desktop.
ecobici data preparation time
# concatenar Hora_Retiro y Fecha_Retiro
viajes['fecha_hora_retiro'] = viajes.Fecha_Retiro + ' ' + viajes.Hora_Retiro
# cambiar de str a datetime
viajes['fecha_hora'] = viajes.fecha_hora_retiro \
.map(lambda x : datetime.strptime(x, '%d/%m/%Y %H:%M:%S'))
# reindexar el dataframe
viajes.index = viajes.fecha_hora
# limpiar valores de otros años
viajes = viajes.loc['2018-10']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment