Vectorbt type object 'DOMWidget' has no attribute '_ipython_display_'

418 views Asked by At

So I'm trying to plot a simple RSI indicator in Python using the Vectorbt library. The RSI plots correctly but there's an error that comes with it. As can be seen here `

#nilagyan ng r para raw file dahil nababasa ng python as UNICODE pag may slash tapos U ang kasunod
df = pd.read_csv(r"C:\Users\Mark\Documents\Trading\BTC-2021min\BTC-2021min.csv")

#dahil ang unix code ay about sa time, cinonvert sa seconds para magkaroon ng column na date
#basically nag add tayo ng COLUMN or Data Frame na pangalan ay date
df["date"] = pd.to_datetime(df["unix"], unit = "s")

#nanggawa ng column at index na date at time kaya nakaSET ang INDEX sa DATE
df.set_index("date", inplace=True)

#aggregation ng 1 minute candles into something bigger, sakin ay 15 minutes kaya 15T
df = df.resample("15T").agg({
    "open":"first",
    "high": "max",
    "low": "min",
    "close": "last",
})

#this makes it go through only a specific date rather than the whole csv file, start date at end date lang 
df = df.loc["2021-10-01":"2021-10-31"]


rsi = vbt.RSI.run(df.close, window=8)

rsi.plot()

When I run this using Jupyter notebook, I encounter this error:

`

AttributeError                            Traceback (most recent call last)
File c:\Users\Mark\AppData\Local\Programs\Python\Python310\lib\site-packages\IPython\core\formatters.py:920, in IPythonDisplayFormatter.__call__(self, obj)
    918 method = get_real_method(obj, self.print_method)
    919 if method is not None:
--> 920     method()
    921     return True

File c:\Users\Mark\AppData\Local\Programs\Python\Python310\lib\site-packages\plotly\basewidget.py:741, in BaseFigureWidget._ipython_display_(self)
    737 """
    738 Handle rich display of figures in ipython contexts
    739 """
    740 # Override BaseFigure's display to make sure we display the widget version
--> 741 widgets.DOMWidget._ipython_display_(self)

AttributeError: type object 'DOMWidget' has no attribute '_ipython_display_'


How do I remove this error?

I actually tried using ChatGPT to gain some ideas. But it told me to upgrade plotly which I did. But I got the latest version.

Im using Python 3.10.9 because it's the latest version supported by Vectorbt.

0

There are 0 answers