I have a dataframe with gaps between date.
It`s necessary to groupby the first 2 columns of this dataframe and then fill the gaps.
What I am trying is this:
df.groupby(['cod_interno', 'unidade_lojas', 'data']).apply(lambda x : x.resample('D').ffill()).reset_index(level=0,drop=True)
However I got this error message:
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Int64Index'
Is there a better approach to solve this ?
I tried this approach Resampling a multi-index DataFrame, but I not so familiar with 'stack()'