Import numpy's where() method directly instead of importing the entire numpy module
This commit is contained in:
parent
bb726df31a
commit
cc823e44ed
@ -1,4 +1,4 @@
|
|||||||
import numpy as np
|
from numpy import where
|
||||||
from pandas import DataFrame, Series
|
from pandas import DataFrame, Series
|
||||||
from indicators import rsi
|
from indicators import rsi
|
||||||
|
|
||||||
@ -11,5 +11,5 @@ def five_period_rsi(data: DataFrame) -> Series:
|
|||||||
rsi_5 = rsi(data, period = 5)
|
rsi_5 = rsi(data, period = 5)
|
||||||
rsi_below_35 = rsi_5 < 35
|
rsi_below_35 = rsi_5 < 35
|
||||||
|
|
||||||
signals = np.where(rsi_below_35, 'L', 'N')
|
signals = where(rsi_below_35, 'L', 'N')
|
||||||
return Series(signals, index = data.index)
|
return Series(signals, index = data.index)
|
Loading…
Reference in New Issue
Block a user