I am interested in extracting rows where the column value either grew cumulatively, at least 5, or fell cumulatively, at least 5, and then get signs of these cumulative changes up_or_down.
For example, let's say I want to apply this to a column yin the following:
df = pd.DataFrame({'x': range(16), 'y': [1,10,14,12,13,9,4,2,6,7,10,11,16,17,14,11]})
It should turn out:
x y
1 10
6 4
10 10
12 16
15 11
My dataframe is quite large, so I was hoping there was a good vectorized way to do this initially using the pandas API, rather than scrolling it using iterrows().
source
share