0
I need to merge between two tables where the base table is grouped at 5 minute intervals, however in an interval that has no record to be grouped the corresponding row is not created
I am dealing with radar data in São Paulo and, for example, in the morning intervals, has less passage of cars, and often does not pass any, so that in the grouping this record of "empty" does not appear ;(
df_agregado = df_agregado.groupby([ 'Numero Agrupado',pd.Grouper(key='Data', freq='5Min')]).agg({ Registro": "count",Velocidade': 'mean'})
Expected result:
Registro Velocidade
2018-01-03 00:00:00 nan nan
2018-01-03 08:05:00 nan nan
2018-01-03 08:10:00 nan nan
2018-01-03 08:15:00 5 22
2018-01-03 08:20:00 10 31
2018-01-03 08:25:00 nan nan
Result obtained:
Registro Velocidade
2018-01-03 08:15:00 5 22
2018-01-03 08:20:00 10 31
The test dataset is available here for Dataframe before and after grouping
Obs.: Note that between 1:50 and 2:00 there is no record of 1:55
You can provide an example dataset so that we can replicate your problem?
– Lucas
I just made available
– guilistocco