0
I am trying to make an Index of the data I have in a Dataframe (regastei via API GET) for a table I created in Postgresql. I searched a lot but I could not get a return. Someone can help me?
Imported libraries: import requests, import pandas as pd, import urllib, json and import psycopg2
con = psycopg2.connect(
user = "sa",
password = "123",
host = "localhost",
database = "db",
port = 5432
)
cur = con.cursor()
with urllib.request.urlopen("Url q vou consumir") as url:
data = json.loads(url.read().decode())
#print(data)
df = pd.DataFrame(data)
#regional, marca, descricaoregional, nomeoriginal, regioao, versao
newdf = pd.DataFrame(df, columns = ['regional','marca_2','regional_2','nome_da_regional','norte_e_sul','versao'])
cur.close()
con.close()