Revision: 68039
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 17, 2014 12:31 by torresbernardo
Initial Code
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
# names: nome das colunas - id_servidor, renda depois dos descontos, nome
# formats: formatos - integer tamanho 12, float tamanho 10, string tamanho até 50
# converters: converte vÃrgula pra ponto pra transformar em float
>>> dtype = {'names''income', 'id_servidor', 'name'], 'formats''f10', 'i12', 'S50'), 'converters':{27:lambda x: x.replace(',', '.')}}
# carrega os dados do arquivo CSV
>>> data = numpy.genfromtxt('20140930_Remuneracao.csv', delimiter='\t', skip_header=1, invalid_raise=False, usecols=(27, 2, 4), dtype=dtype, converters=dtype['converters'])
# ordena pelo salário
>>> winning = sorted(data, key=lambda x: x[0], reverse=True)
# lista os 50 funças mais felizardos da nação Huelândia
>>> winning[:50]
Initial URL
http://www.portaltransparencia.gov.br/downloads/servidores.asp
Initial Description
Utiliza os dados do site: http://www.portaltransparencia.gov.br/downloads/servidores.asp Escolha um mês e ano, baixe o .zip, descompacte e na pasta descompactada, execute.
Initial Title
Analisar dados dos servidores do Governo Federal
Initial Tags
data
Initial Language
Python