RS trading strategy sec 3 Unit 14

getting this error
numpy.ndarray' object has no attribute 'loc'

when running:
df.loc[df['RS']>df['RS_slow'],'Signal'] = 1

iam typing what was exactly in the module(since basics are not explained so still confused what shud be done)

Hello Waseem,

The code in section 3 unit 14 seems correct. Before calling the loc function make sure the type of df is a pandas.DataFrame. Here it seems, that somehow you called it on a numpy array. That is why we see the error:

numpy.ndarray' object has no attribute 'loc'

 

Do get back if help is needed.