I have the following time series:

`2017-11-01 200.000000
2017-12-01 394.000000
2018-01-01 537.000000
2018-02-01 537.000000
2018-03-01 537.000000
2018-04-01 537.000000
2018-05-01 537.000000
2018-06-01 537.000000
2018-07-01 137.000000
2018-08-01 88.000000
2018-09-01 10.000000
2018-10-01 100.000000
2018-11-01 100.000000
2018-12-01 111.000000
2019-01-01 362.000000
2019-02-01 563.000000
2019-03-01 706.000000
2019-04-01 750.000000
2019-05-01 785.000000
2019-06-01 785.000000`

I am dealing with a periodic time series, where the values are cumulative from September to August.
In September the value should be lower than the previous. This is not true for previous months!
So, my time series is wrong 2018-07-01 and 2018-08-01, but it's right in 2018-09-01.
I want to substitute those values with the last one in 2018-06-01 (537.0).

I used the .shift(1) pandas option, but I have been able only to substitute July's values with June's, but I replaced August with the previous value of July! Here the code I used:

```
new_df = pd.DataFrame({'date': new_df.index.tolist(), 'vals': new_df.tolist()}) # from df to ts
new_df['shift_values'] = new_df['vals'].shift(1) # create a col with previous values
new_df['diff'] = new_df.apply(lambda x: x['vals']-x['shift_values'], axis=1) # calculate the difference
new_df['valore_finale'] = new_df.apply(lambda x: x['vals'] if x['date'] == '2019-09-01' else(x['vals'] if x['diff']>0 else x['shift_values']), axis=1)

```

`2017-11-01 200.000000
2017-12-01 394.000000
2018-01-01 537.000000
2018-02-01 537.000000
2018-03-01 537.000000
2018-04-01 537.000000
2018-05-01 537.000000
2018-06-01 537.000000
2018-07-01 537.000000 # changed
2018-08-01 537.000000 # changed
2018-09-01 10.000000 # no changed
2018-10-01 100.000000
2018-11-01 100.000000
2018-12-01 111.000000
2019-01-01 362.000000
2019-02-01 563.000000
2019-03-01 706.000000
2019-04-01 750.000000
2019-05-01 785.000000
2019-06-01 785.000000`