Last active
November 26, 2018 21:05
-
-
Save gonzalezgouveia/3cde5bb4cd9605f88e07c786a64f8cd4 to your computer and use it in GitHub Desktop.
ecobici data preparation time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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