0

I am using ta-lib for Technical Analysis in Python. Here is a small piece of code I wrote:

SBIN=pd.read_csv('SBIN.NS.csv')
ema=TA.SMA(SBIN.Close,timeperiod=20)

The first 19 values in the ema array are NaN, which are totally understandable. But after a certain position also, ema has NaN values. Why is this happening?

Ronith
  • 11
  • 2

1 Answers1

1

The csv file SBIN.NS.csv contains NaN values.SBIN.dropna(axis=0) will solve the problem.It will drop all the rows that contains NaN values.

SBIN=pd.read_csv('SBIN.NS.csv')
SBIN.dropna(axis=0)
ema=TA.SMA(SBIN.Close,timeperiod=20)