AttributeError: 'Series' object has no attribute 'ta'

107 Views Asked by At
import pandas as pd
import pandas_ta as ta

macd = data['CLOSE'].ta.macd(fast=12, slow=26, signal=9)
data = pd.concat([data, macd], axis=1)

data['RSI14'] = data['CLOSE'].ta.rsi(length=14)

data['EMA10'] = data['CLOSE'].ta.ema(length=10)
AttributeError: 'Series' object has no attribute 'ta'

And I did !pip install pandas_ta already.

So can't get what's wrong with ta.

1

There are 1 best solutions below

0
workhandle On

As said by the OP in comments, this is the solution:

import pandas as pd
import pandas_ta as ta
data['EMA'] = data['CLOSE'].ewm(span=10, adjust=False).mean()
data['RSI14'] = ta.rsi(data['CLOSE'], length=14)
macd = ta.macd(data['CLOSE'])