October 26, 2024
Chicago 12, Melborne City, USA
python

Using Ta-lib in Google Colab


I use this code in Google Colab:

import pandas as pd
import yfinance as yf
import talib as ta

data = yf.download("GOOG")
data['RSI'] = ta.RSI(data["Close"], timeperiod=10)

And this is the output:

[*********************100%***********************]  1 of 1 completed
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-e3c5cad38926> in <cell line: 6>()
      4 
      5 data = yf.download("GOOG")
----> 6 data['RSI'] = ta.RSI(data["Close"], timeperiod=10)

/usr/local/lib/python3.10/dist-packages/talib/__init__.py in wrapper(*args, **kwargs)
     25 
     26             if index is None:
---> 27                 return func(*args, **kwargs)
     28 
     29             # Use Series' float64 values if pandas, else use values as passed

TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got DataFrame)

What is wrong with my code? I have used ta-lib before. But now I can’t use it. Why?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video