'NumPy arange only finds numbers without decimal value

I am currently trying to assess the most recent number of a np array and scatter plot the value on another graph if the value is within a certain range. As all values are float, I figured it best to use np.arange() for this process. While this works for numbers that do not have decimal values, it does not for numbers with decimal values.

What could I change for this to include numbers with decimal values?

An example of the code (with a range that is likely to guarantee a result):

import yfinance as yf, pandas as pd, numpy as np, datetime as dt
from matplotlib import pyplot as plt

data = tick.history(period='1d', interval= '5m')
data_prices = data['Close']

returns = data_prices.diff()

concavity = returns.diff()
concavity.replace([np.inf, -np.inf], np.nan, inplace=True)
df = pd.DataFrame(concavity)

concavity2 = np.asarray(concavity)
concavity2.flatten()

plt.plot(data_prices, zorder=1)

if concavity2[-1] in np.arange(start=-20, stop=1000):
    plt.scatter(df.last_valid_index(),\
    data_prices[df.last_valid_index()],\
    s=15, color = 'red', zorder = 2) 

plt.grid()
plt.show() 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source