Can I create multiple dataframes in a loop?
I have a long list of webscraped information but I want to turn them into multiple dataframes. Not sure if this is possible....
Below is my original webscraped code:
indicator = {'SI.POV.GINI?date=2000:2020','SL.UEM.TOTL.ZS?date=2000:2020','NE.IMP.GNFS.ZS?date=2000:2020','NE.EXP.GNFS.ZS?date=2000:2020'}
url_list = []
for i in indicator:
url = "http://api.worldbank.org/v2/countries/all/indicators/%s&format=json&per_page=5000" % i
url_list.append(url)
result_list = []
for i in url_list:
response = requests.get(i)
print(response)
result_list.append(response.content)
result_json = []
for i in range(len(result_list)):
result_json.append(json.loads(result_list[i]))
result_json
If not, I've also opted to do it manually but i'm getting an error
gini_df = pd.DataFrame.from_dict(result_json[0])
gini_df
AttributeError: 'list' object has no attribute 'keys'