I have a pandas dataframe with time index and want to normalize every row of a column by the maximum value observed to that date and time.
# an example input df
rng = pd.date_range('2020-01-01', periods=8)
a_lst = [2, 4, 3, 8, 2, 4, 10, 2]
df = pd.DataFrame({'date': rng, 'A': a_lst})
df.set_index('date', inplace=True, drop=True)
(a possible solution is to iterate over the rows, subset the past rows,and then divide by the max [1,2,3], but it would be inefficient)