Created
July 5, 2021 15:15
-
-
Save idcesares/2ec7045605703e76f85d2f12465dde24 to your computer and use it in GitHub Desktop.
Exportar cidades brasileiras da api do IBGE para csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import requests | |
response = requests.get('https://servicodados.ibge.gov.br/api/v1/localidades/municipios') | |
df = pd.read_json(response.text) | |
cidades = df['nome'] | |
cidades.to_csv("cidades.csv", index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment