Dataset is a daily time series of 9 variables on a daily scale
I have extracted the dataset
Data = pd.read_csv('city10.csv', header = None)
Data['Date'] = pd.date_range(start='1/1/1951', periods=len(Data), freq='D')
Data.set_index('Date', inplace=True)
It looks like this
Date 0 1 2 3 ... 5 6 7 8
1951-01-01 28.361 0.0 131.24 405.39 ... 405.39 38.284 0.187010 -1.23550
1951-01-02 27.874 0.0 113.74 409.56 ... 409.56 49.834 0.066903 -1.44770
... ... ... ... ... ... ... ... ...
2005-12-16 27.921 0.0 104.99 429.78 ... 429.78 47.529 -1.814300 -5.47720
2005-12-17 27.918 0.0 112.11 425.32 ... 425.32 46.541 -3.314000 -4.02050
After this I found the month mean of the entire dataet i.e.
Data.groupby(Data.index.month).mean()
The result is
0 1 2 ... 6 7 8
1 29.619322 0.215978 108.621532 ... 45.868395 -0.234236 -1.865947
2 32.404500 0.290335 95.270385 ... 43.443624 0.554149 -2.360776
3 35.131266 0.364438 78.907920 ... 42.065113 1.458203 -2.636451
4 36.631282 0.998401 53.663939 ... 44.239469 3.146849 -2.193416
5 36.823308 2.113330 37.917831 ... 54.287356 5.241153 -0.694375
6 34.444513 2.195926 35.315554 ... 67.840239 6.393643 0.689087
7 32.951826 3.567160 32.466668 ... 82.347247 6.583195 1.183262
8 32.644236 4.053641 36.379228 ... 85.056697 5.102383 0.005426
9 32.205442 4.885259 50.595568 ... 80.335829 2.413891 -0.578568
10 30.448266 5.748111 79.575731 ... 67.582589 -0.769297 -0.614057
11 28.748315 4.350384 100.293532 ... 53.418955 -1.258580 -1.023143
12 28.155611 1.524177 109.510292 ... 51.317731 -0.936495 -1.549105
Now,how to subtract the mean of each month with the respective values of that month of each year.
For e.g.
January month mean for time-series 1951-2005 is 20.25
This mean has to be subtracted from daily values of all January month.
How to do this?