Hi, I am trying to use the API rdp.get_snapshot() on jupyter notebook (with Python 3.6.10, pandas 1.1.3 and refinitiv-dataplatform 1.0.0a6) but it has returned
AttributeError: 'DataFrame' object has no attribute 'convert_dtypes'
Does anyone have a clue? Thanks.
Here is my code:
import refinitiv.dataplatform as rdp
import pandas as pd
APP_KEY = ''
RDP_LOGIN = ''
RDP_PASSWORD = ''
GRANT = rdp.GrantPassword(username=RDP_LOGIN, password=RDP_PASSWORD)
session = rdp.open_platform_session(APP_KEY, GRANT)
snap = rdp.get_snapshot(['EUR='],['BID'])
I have checked the source code of pandas 1.1.3 at https://github.com/pandas-dev/pandas/blob/v1.1.3/pandas/core/generic.py#L5179.
The source code at line 5179 doesn't match the application's call stack.
However, it matches pandas 0.25.3 instead: https://github.com/pandas-dev/pandas/blob/v0.25.3/pandas/core/generic.py#L5179.
You may need to verify the version of Pandas in the ~\AppData\Local\Continuum\anacondas3\envs\refiniitv\lib\site-packages\pandas directory.
pd.__version__
You are indeed correct on the Pandas version. It returned version 0.25.3
It seems I may have multiple versions of Pandas installed. How do I make sure I can consolidate these versions or to call the latest/suitable version?
Hi @jasmine.lee
There were several issues addressed in the 1.0.0a7 build - are you able to try that out?
https://pypi.org/project/refinitiv-dataplatform/1.0.0a7/
Hello @jasmine.lee
Based on our discussion yesterday, I am noticed that your username is a "machine-id" (GE-XXXXXXXXXXXX) which aims to use with Refinitiv Real-Time Optimized (aka ERT in Cloud) to get a streaming data, not to use with RDP REST API. The username for your RDP should be in email format.
Could you please also test /data/pricing/beta3/snapshots endpoint in RDP API Docs page?
I can't replicate the issue with 1.0.0.6a; it could be an issue about your account, as Wasin said. Please test your account with APIDocs first.
I have created a new env with python 3.6 RDP 1.0.0.6a with the same pandas' version and then install httpx 0.14.2 to avoid the issue when opening a session as mentioned in
Then I just call
snap = rdp.get_snapshot(['EUR='],['BID'])
And get the data as expected.
Actually, the internal codes try to get data using the following query parameters to the endpoint.
https://api.refinitiv.com/data/pricing/beta3/snapshots?universe=EUR%3D&fields=BID
You may add
session.set_log_level(6)
after the code to open a session. It should print an additional log in the notebook.
@jirapongse.phuriphanvichai
You are indeed correct on the Pandas version. It returned version 0.25.3
It seems I may have multiple versions of Pandas installed. How do I make sure I can consolidate these versions or to call the latest/suitable version?
You may consider using Python Virtualenv. It is a tool to create isolated Python environments. There are a lot of Virtualenv usages and articles. For example:
Hello @jasmine.lee
The other tool that can help you to isolate Python environment (Python version, RDP version, pandas version, etc) is Anaconda and MiniConda.
Please see how to use miniconda to setup environment for Python API in "Setting up a Python development environment" section of Eikon Data API tutorial. The tutorial uses Eikon Data API as an example which can be applied to RDP libraries too.