0

I am trying to use either for loop or anything else to put list inside parameters reporter ='arg'

for instance list ['arg','AFG','ALB','DZA'] and then save them in one dataframe

import pandas as pd
import world_trade_data as wits    
pd.set_option('display.max_rows', 6)


Countery_IMPORT = wits.get_indicator('MPRT-TRD-VL', reporter='arg', year='all',partner='wld',datasource='tradestats-trade',name_or_id='name')
1
  • I used this countery = ['AFG','ALB','DZA'] for x in countery: but not working Commented Aug 23, 2021 at 8:22

1 Answer 1

1

Simple list comprehension to concat

import pandas as pd
import world_trade_data as wits

pd.set_option("display.max_rows", 6)

Countery_IMPORT = pd.concat(
    [
        wits.get_indicator(
            "MPRT-TRD-VL",
            reporter=arg,
            year="all",
            partner="wld",
            datasource="tradestats-trade",
            name_or_id="name",
        )
        for arg in ["arg", "AFG", "ALB", "DZA"]
    ]
)

Countery_IMPORT
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.