I've got a pandas.Series
of integers that looks like this:
1959-09-22 191.0
1959-09-23 196.0
1959-09-24 222.0
1959-09-25 232.0
1959-09-28 232.0
1959-09-29 242.0
1959-09-30 241.0
1959-10-01 247.0
1959-10-02 251.0
1959-10-05 275.0
1959-10-06 294.0
1959-10-07 313.0
1959-10-08 332.0
1959-10-09 343.0
1959-10-12 346.0
1959-10-13 344.0
1959-10-14 351.0
1959-10-15 336.0
1959-10-16 330.0
1959-10-19 319.0
1959-10-20 329.0
1959-10-21 356.0
1959-10-22 374.0
What I want to do is process this list so the difference between consecutive integers is never less than 10%. If it is, then keep the last value until the difference exceeds 10% from the current value.
What is the most pythonic way of doing this?
As some background, this is a list of financial positions, and the idea is to reduce trading costs by not trading small differences in overall position.
Aucun commentaire:
Enregistrer un commentaire