0

This is most likely very simple to correct, unfortunately, I'm new to python and need a bit of help in how to go about it.

I run the following code...

import eikon as ek
import pandas as pd
import xlwings as xw

ek.set_app_id("secretpasswordstring")

# In[2]:


isins = pd.read_excel(r'W:\L\BDTP\Products\FSA_DAC_Updates\DAC_TOOL.xlsm','ISIN_Equity',usecols='B').dropna()
rics, err = ek.get_data(isins['ISIN'].tolist(),['TR.PrimaryRic'])
rics = rics[rics['Primary Issue RIC']!='']
rics = rics[~rics['Primary Issue RIC'].str.contains('^',regex=False)]
riclist = rics['Primary Issue RIC'].tolist()
riclist

...which creates this error message:

runfile('W:/L/BDTP/Products/FSA_DAC_Updates/percent change (1).py', wdir='W:/L/BDTP/Products/FSA_DAC_Updates') Traceback (most recent call last):

File "", line 1, in runfile('W:/L/BDTP/Products/FSA_DAC_Updates/percent change (1).py', wdir='W:/L/BDTP/Products/FSA_DAC_Updates')

File "C:\Python\winpython_3_5_4_1_QT5\python-3.5.4.amd64\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile execfile(filename, namespace)

File "C:\Python\winpython_3_5_4_1_QT5\python-3.5.4.amd64\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "W:/L/BDTP/Products/FSA_DAC_Updates/percent change (1).py", line 18, in rics, err = ek.get_data(isins['ISIN'].tolist(),['TR.PrimaryRic'])

File "C:\Python\winpython_3_5_4_1_QT5\python-3.5.4.amd64\lib\site-packages\eikon\data_grid.py", line 125, in get_data check_for_string_or_list_of_strings(instruments, 'instruments')

File "C:\Python\winpython_3_5_4_1_QT5\python-3.5.4.amd64\lib\site-packages\eikon\tools.py", line 57, in check_for_string_or_list_of_strings raise ValueError('All items in the parameter {0} should be of data type string, found {0}'.format(name,[type(v) for v in parameter]))

ValueError: All items in the parameter instruments should be of data type string, found instruments

What do I need to do in order to solve this error? Why does it appear? I was under the impression, that I was always passing strings, given that all data i'm inputing are strings (12 character ISINs).

rohrl77
  • 3,277
  • 11
  • 47
  • 73
  • Strange. It does work with Python 3.7 and Pandas version 23.4. Can you give a sample of your data? Did you try a file with just one instrument? – PythonSherpa May 16 '19 at 08:51
  • I just tested it with your suggestion... using only two instruments it worked ok. I will now attempt to add on 50 ISINs at a time, and see if the error reappears... – rohrl77 May 20 '19 at 08:57

0 Answers0