Skip to content

Instantly share code, notes, and snippets.

@Irio
Created January 23, 2018 17:20
Show Gist options
  • Save Irio/07c66175961a0525966360879bd06534 to your computer and use it in GitHub Desktop.
Save Irio/07c66175961a0525966360879bd06534 to your computer and use it in GitHub Desktop.
Estados do Brasil e suas capitais
import pandas as pd
csv = """
AC,Acre,Rio Branco
AL,Alagoas,Maceió
AP,Amapá,Macapá
AM,Amazonas,Manaus
BA,Bahia,Salvador
CE,Ceara,Fortaleza
DF,Distrito Federal,Brasília
ES,Espírito Santo,Vitória
GO,Goiás,Goiânia
MA,Maranhão,São Luiz
MT,Mato Grosso,Cuiabá
MS,Mato Grosso do Sul,Campo Grande
MG,Minas Gerais,Belo Horizonte
PA,Pará,Belém
PB,Paraíba,João Pessoa
PR,Paraná,Curitiba
PE,Pernambuco,Recife
PI,Piauí,Terezina
RJ,Rio de Janeiro,Rio de Janeiro
RN,Rio Grande do Norte,Natal
RS,Rio Grande do Sul,Porto Alegre
RO,Rondônia,Porto Velho
RR,Roraima,Boa Vista
SC,Santa Catarina,Florianópolis
SP,São Paulo,São Paulo
SE,Sergipe,Aracajú
TO,Tocantins,Palmas
"""
lines = [pd.Series(line.split(',')) for line in csv.split('\n')[1:-1]]
cols = ['state', 'state_name', 'capital']
states = pd.DataFrame(lines)
states.columns = cols
states
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment