there are bunch of rest api request, where each request have similiar data. Once I call the url and parse the data that I want, I want to create pandas data frame, create one big data frame after I am done with all of the requests. So data string below should be appended to a data frame:
#this code is to call each url and get the data
hyperId=['hyper1', 'hyper2','hyper3']
#creating empty data frame with column names
df1=pd.DataFrame(columns = ['id','servername', 'modelname'
for id in hyperId1:
hyperUrl="http://testabc"+id
resp = requests.get(hyperurl)
data1=id+","+resp['servername']+","+resp['model']
#output of each request
print(data1)
hyper101,serverabc,proliant
I need to append data1 to data frame called df1 as below
df1 = pd.read_csv(io.StringIO(data1))
df1=df1.append(data)
I am very new to python and pandas. When I run this it says empty data frame with everything appended to the column including column names and actual data. Any help would be appreciated.
APIinto a list, then finally create the dataframe out of it usingdf = pd.DataFrame(dataList, columns= ['id','servername', 'modelname'])