0
I am new in the language, after the execution of the following code, the result of the append made is a list. I needed this information in dataframe, but so far I could not find a way to convert without losing information. Whenever I try to move to dataframe (even with Concat tried), only one of the lines appears in it.
appended_data = []
for i in a:
url = 'https://www.receitaws.com.br/v1/cnpj/{0}'.format(i)
req = requests.get(url)
code = req.status_code
if code == 200:
html = req.text
receita = json.loads(html)
dataframe=pd.DataFrame(
{
'Atividade Principal': [receita['atividade_principal'][0]['text']],
'Situação cadastral': [receita['situacao']],
'Status': [receita['status']],
'Sócio 1 (role)': [receita['qsa'][0]['qual']],
'Sócio 1': [receita['qsa'][0]['nome']],
'Sócio 2 (role)': [receita['qsa'][1]['qual']],
'Sócio 2': [receita['qsa'][1]['nome']],
'Nome': [receita['nome']],
'UF': [receita['uf']]
}
)
appended_data.append(dataframe)
appended_data