How can I divide single values of a dataframe by monthly averages?
I think it is generally recommended to use Grouper instead of TimeGrouper. Have a look at this. For example, if your column is called Date, use
grouper = pd.Grouper(key='Date', freq='M')
instead of using TimeGrouper and then continue as @Zelazny7 suggested. If your column is not a datetime index then use
df['Date'] = pd.to_datetime(df['Date'])
First make a grouper:
import pandas as pd
In [1]: grouper = pd.Grouper(freq="1M")
Then make your new column:
In [2]: df['normed'] = df.groupby(grouper).transform(lambda x: x/x.mean())
By passing grouper to the groupby
method you group your data into one month chunks. Within each chunk you divide the 15 minute interval datum by the mean for that month.