question

Upvotes
Accepted
3 0 0 0

AttributeError: 'DataFrame' object has no attribute 'convert_dtypes'

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'])


rdp-apirefinitiv-data-platformrefinitiv-data-platform-librariessnapshot-pricing
1604500666201.png (69.8 KiB)
1604500709353.png (73.5 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
45.2k 103 43 60

@jasmine.lee

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__

1604636669007.png (14.8 KiB)
1604636785413.png (57.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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?

Upvotes
23.5k 84 10 22

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/


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
14.3k 23 8 12

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?



rdp.png (105.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
7.6k 15 6 9

@jasmine.lee

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

https://community.developers.refinitiv.com/questions/66645/rdp-libraries-request-object-has-no-attribute-prep.html


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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 0 0

@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?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@jasmine.lee

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.