How to check for a range of values in a pandas dataframe?
<p>I have a pandas dataframe in which I want to check if a future value is greater than the given value for a range of future dates.
For example</p>

<pre><code>np.where((df['Close'].shift(-1) - df['Close'])  &gt; 0 , 1, 0)
</code></pre>

<p>This will give me if next value is greater than current value, I want to check if current value is greater than say next 5 values ?</p>

<p>You could use <code>pd.rolling_max</code> for this, something like</p>

<pre><code>window = 5
pd.rolling_max(df['Close'], window).shift(-window) - df['Close'])  &gt; 0 
</code></pre>

python numpy dataframe