Setting freq of pandas DatetimeIndex after DataFrame creation
ABB is pandas DataFrame, whose index type is DatetimeIndex.
DatetimeIndex has freq attribute which can be set as below
ABB.index.freq = 'd'
Check out the change
ABB.index
Try:
ABB = ABB.asfreq('d')
This should change the frequency to daily with NaN
for days without data.
Also, you should rewrite your for-loop
as follows:
for index, row in ABB.iterrows():
print(ABB.loc[[index + pd.Timedelta(days = 1)]])
Thanks!