This is a part of a Python API Connection program
Here is the DataFrame Sample
Region Sector Brand ID Start Date
7188 US 41 40000 2006-03-06
7189 US 41 40345 2017-11-06
7190 US 41 40123 2019-01-12
7191 US 42 40145 2001-02-06
7192 US 42 40185 2013-03-16
Here is the working function as a part of API python program which usually takes a fixed parameter values i.e; Region, Sector, Brand ID, Start Date, End Date="05-04-2020", Scoring ="total".(End Date and Scoring are fixed values, rest of them are keep changing).
#This code is working if manually enter
#details of a Dataframe one by one which is inefficient.
#This code generates me a URL of a dataset using the parametersquerySingleBrandTimeline('db.csv', {'region':'us','sector':'41', 'brand_id':'40000', 'scoring':'total', 'start_date':'2006-03-06','end_date':'2020-03-31'})
What I am trying to achieve is a for loop which takes values from the pandas DtaFrame and put it in the function parameters accordingly.
Here is the sample code i've tried:
for id in US['Sector']:for brandid in US['Brand ID']:querySingleBrandTimeline('db.csv', {'region':{}.format(US['Region']),'sector':{}.format(US['Category ID']), 'brand_id':{}.format(US['Brand ID']), 'scoring':'total'}, 'start_date':{}.format{US['Start Date']},'end_date':'2020-03-31'})
I'm quite not sure how to pass values of the DataFrame to the function dynamically