Retrieve Balance sheet data based on a list of RICs and Data items

Hello,

I would appreciate to receive an urgent support regarding retrieving data. I run into an error when trying to retrieve bank balance sheet data based on a set of RICs and Data items. I have documented a list of RICs and Data items and use pandas to read and print it in Python. However, when I get to the ek.get_data code part, there is an error called back.

The code I attempted:

df3, e = ek.get_data(df['RICs'],df1['Dataitem'],parameters= {'SDate':'1999-12-31','EDate' :'2021-03-01','Period': 'FQ0','Frq':'FQ','reportingState':'Rsdt', 'curn':'Native', 'Scale':'3'})

The invalid syntax I received:

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

What should I change in this case to make it work?

Thank you so much in advance for any advices and guidances!

PS: The RICs and Dataitems that I created are as below:

1625522226807.png1625522207228.png


Best Answer

  • jason.ramchandani01
    Answer ✓

    @Diep.Tran The following is definitely working for me:

    instruments = ['KAER.VI','TIRO.VI']
    data1 = pd.DataFrame()

    for i in instruments:
        try:
            df1, e = ek.get_data(i,['TR.F.CashSTDeposDueBanksTot.date','TR.F.CashSTDeposDueBanksTot'],parameters= {'SDate':'1999-12-31','EDate' :'2021-03-01','Period': 'FQ0','Frq':'FQ','reportingState':'Rsdt', 'curn':'Native', 'Scale':'3'})
            if len(data1):
                data1 = data1.append(df1, ignore_index=True)
            else:
                data1 = df1
        except:
            pass
    data1

    1625661795442.png

Answers