FutureWarning for data_grid.py (pandas.np module is deprecated and will be removed... import numpy d

Hi,

I see a warning when using Eikon's Python API package (eikon). The commands I ran were:

  1. import eikon as ek
  2. ek.set_app_key('....')
  3. df2, err = ek.get_data(['RIC_1', 'RIC_2' ...], ['TRD_STATUS'])

The warning message I see is:

C:\Users\kengwong\KOminiconda3\envs\brk\lib\site-packages\eikon\data_grid.py:247: FutureWarning: The pandas.np module is deprecated and will be removed from pandas in a future version. Import numpy directly instead
  data = pd.np.array([[get_data_value(value) for value in row] for row in data_dict['data']])

This is not an error, it looks more like a warning.

Cheers,
Keng Onn

Best Answer

Answers

  • Here're the versions of Python, pandas and eikon that I'm using:

    • Python: 3.6.8
    • eikon: 1.1.2
    • pandas: 1.0.1
  • Thanks, yes, your reply is fine. I've clicked "Accept". Thanks!

  • Hello! @""

    Is there an update to this, please? The pandas.np submodule will be deprecated and we will not be able to run get_data() requests unless they are changed.

  • Hello! @""

    Is there an update to this, please? The pandas.np submodule will be deprecated and we will not be able to run get_data() requests unless they are changed.

  • @alex.yermolayev

    There is no update from the product team.

    However, from my testing, the data can be retrieved properly although it reports the warning messages.

    image

    Otherwise, you may need to use pandas < 1.0.0 instead.

  • Pandas is now using SemVer so pd.np should be available through pandas 2.0.0 without code breakage (deprecations introduced in the 1.x series will no longer be removed until 2.x). Realistically it will probably last at least a year.


    That said, referencing pd.np was never good design practice. Pandas's internal import of numpy accidentally made it into the public pandas namespace but wasn't supposed to be used. This should be fixed in the eikon code to import numpy as np directly.