Plotly Not Working in CODEBK?
Hello, trying to use plotly to plot this simple dataframe (dfplot):
index Strat1
237 2022-11-29 -0.159187
238 2022-11-30 3.094787
239 2022-12-01 -0.086763
240 2022-12-02 -0.000000
241 2022-12-05 -0.000000
Using this code:
import plotly.express as px
fig = px.line(dfplot, x="Date", y="Daily Return", title='Daily Return Historical Chart')
fig.show()
But I get the error:
AttributeError: module 'dask.array' has no attribute 'lib'
AttributeError Traceback (most recent call last)
/tmp/ipykernel_200/32131141.py in <module>
----> 1 import plotly.express as px
Is there any dependencies not working properly ?
Best Answer
-
Hello @Aleniles
Thank you for the information. I checked my Eikon (version 4.0.60018, not the latest). The CodeBook App on my Eikon is version 3.0 (March 2022) with the following dependencies versions:
- JupyterLab 3.2.4
- Python 3.8.13
- Plotly 5.4.0
- Dask 2021.11.2
You can check the version from the CodeBook "_Changelog.md" file in the main folder as follows:
I highly recommend you contact the Eikon support team directly to help you with this CodeBook app and libraries issue.
In the meantime, can you try the CodeBook app on the Eikon Web version? Please find more detail in this Use CodeBook on Web Browser article.
0
Answers
-
Hello @Aleniles
Are you using the latest version of the Workspace desktop application?
I am testing the following code with CodeBook app on Workspace version 1.19.448 and it works fine.
Firstly, I create the dataframe object and set the "Date" column to be a normal column instead.
Code:
# Creates pandas DataFrame.
data = {'Strat1': [-0.159187,3.094787,-0.086763, -0.000000, -0.000000]}
dfplot= pd.DataFrame(data, index=['2022-11-29','2022-11-30','2022-12-02','2022-12-05','2022-12-05'])
# Reset index to include Date as a data column
dfplot.reset_index(level=0, inplace=True)
dfplot.rename({'index':'Date'}, axis= 1, inplace= True)Result:
Then I plot the graph with plotly:
fig = px.line(dfplot, x="Date", y="Strat1", title='Daily Return Historical Chart')
fig.show()Result
0 -
No, it still doesn't work because the error is directly on the "import plotly.express as px" instruction. That's why I am thinking about "dependencies" problems.
Btw I do not have the same view as you in the workspace. I am running CODEBOOK with Datastream data inside Refinitiv Desktop Eikon 4.0.54 with JupyterLab 1.2.7, plotly 4.8.1
. The python version is the one below.
Unfortunately I am not able to upload a picture due to IT restrictions but believe me: running a simple cell with the "import plotly.express as px" instruction gives the error I mentioned.
Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.0 -- An enhanced Interactive Python. Type '?' for help.0 -
Many thanks.
So in the standalone version I do not have the changelog file either ... so I cannot check.
I tried to connect to the web version and here, indeed, everything works fine. So I suppose I have an outdated version of Codebook installed on my machine, I'll reach out the Refinitiv helpdesk.
One last question:
Do you know how or if it is possible to connect to external APIs using Codebook ?
I have tried this:
import yfinance as yf
Amazon = yf.Ticker("AMZN")
print(Amazon.info)But I am getting this:
HTTPSConnectionPool(host='finance.yahoo.com', port=443): Max retries exceeded with url: /quote/AMZN (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))
I'm wondering if there is a way to set up something (whitelisting servers, setting the SSL or Proxy properly etc) so that it could work.
0 -
Hello @Aleniles
Unfortunately, the CodeBook app allows connection within Refinitiv platforms (Eikon, Refinitiv Data Platform, DataStream, etc) only.
If your notebook app needs to connect to external services/APIs, you need to set up your local Jupyter Lab environment and run a notebook app in your local Jupyter instead. You can find more detail about how to set up Jupyter Lab from the following resources:- Installing Jupyter
- Setup a Data Science Environment on your Computer
- How to Setup Your JupyterLab Project Environment
Caution!
Please contact your Refinitiv representative to confirm if you need a separate Datastream credential to run Datastream in your local environment.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛