I would like to perform a rolling mean while the mean excludes duplicates found in another column. Let me provide an example dataframe:
Date Warehose Value
10-01-1998 London 10
13-01-1998 London 13
15-01-1998 New York 37
12-02-1998 London 21
20-02-1998 New York 39
21-02-1998 New York 17
In this example, let's say I like to perform 30-day rolling mean of Value but taking into account only the last update of the Warehouse location. The resulting dataframe is expected to be:
Date Value Rolling_Mean
02-01-1998 10 10
05-01-1998 13 13
15-01-1998 37 20
12-02-1998 21 29
20-02-1998 39 30
21-02-1998 17 19
The data I have is relatively big so as efficient as possible is appreciated.