If I have a df with a date and values for each day, how can I make the daily increment of that variable?
serie
fecha
2020-03-13 3
2020-03-14 5
2020-03-15 9
2020-03-16 12
2020-03-17 21
2020-03-18 29
I've done
serie1 = serie.reset_index()
for e in serie1.col2:
print(serie1[e] - serie1[e-1])
It returns 5 numbers and I get this error:
IndexError: index out of bounds
Once achieved, how can you know the date on which it begins to descend?
If you have a Series or apply it to a column, assuming it is correctly ordered based on the date, what you are looking for already exists in Pandas, it is
pandas.Series.diff
:In the case of applying it on the column of a DataFrame it is the same: