Liberando Dados Com Um Comando


Turicas aka Álvaro Justen


17° Fórum Internacional de Software Livre

(meu 10º FISL! \o/)

15 de julho de 2016 - Porto Alegre/RS

bit.ly/turicas-fisl17

Turicas, prazer! =)

Sigam-me os bons:

{twitter,
github,
youtube,
slideshare,
instagram}
/turicas

alvaro@CursoDeArduino.com.br

turicas.info

Nômade Digital

Álvaro Justen e sua casa


cursodearduino.com.br


pythonic.cafe


generonumero.media


escoladedados.org

Álvaro Justen wordcloud

Software Livre

Python

Arduino

pythonquito.tk

# E vocês? - Quem trabalha com conversão de dados, *scraping*, *data science*, ...? - Quem conhece/usa Python?

Álvaro Justen e sua casa

A Jornada

Dados Presos

Dado aberto, porém não acessível

O Que Eu Já Fiz

O Que Eu Quero

O Que Tenho Que Fazer

Obtendo...

Verificando...

Limpando...

E Se Fosse CSV?

JSON

XLS, XLSX

rows to the rescue!


pip install rows # Python Package Index

apt-get install rows # Debian

dnf install rows # Fedora


github.com/turicas/rows

## rows - Biblioteca Python - Command-Line Interface - Plugins: - CSV - JSON - HTML (+ XPath) - TXT - XLS - XLSX - SQLite - ODS - Parquet - (+ outros em desenvolvimento)

csv com Python + rows

import rows

table1 = rows.import_from_csv('tesouro-direto.csv')

for row in table1:
    print row


Row(timestamp=datetime.datetime(2015, 11, 6, 17, 43),
    titulo=u'Tesouro IPCA+ com Juros Semestrais 2017 (NTNB)',
    vencimento=datetime.date(2017, 5, 15),
    taxa_compra=Decimal('0.0702'),
    taxa_venda=Decimal('0.063'),
    preco_compra=0.0,
    preco_venda=2792.97)

# namedtuple #FTW \o/

xls com Python + rows

import rows

table2 = rows.import_from_xls('tesouro-direto.xls')

for row in table2:
    print row

html com Python + rows

import rows

table3 = rows.import_from_html('tesouro-direto.html')

for row in table3:
    print row

import rows

Carlton dance
## rows: Funcionalidades - Interface única (não importa o formato) - Escrever é tão fácil quanto ler (*pythonic way*) - Vários plugins - CLI - Conversão **automática** de dados - **Eu já fiz os testes** - Test-driven development - Semantic versioning
## Command-Line Interface - `print`: mostra a tabela em formato texto - `convert`: converte entre os formatos suportados - `sum`: agrega tabelas - `join`: cruza dados - `query`: SQL!
# Live coding (CLI)
## Alguns Casos de Uso - CLI: - Download, conversão e limpeza - Análises preliminares - Biblioteca: - Conversão e limpeza (exemplo: Interlegis) - Conversão e análise (exemplos: scifi, fisl_talks)

Qual o pior melhor formato?

row specs (beta)

Colaboradores

github.com/turicas/rows

#fikdik

latinoware.org

19 a 21 de outubro
Foz do Iguaçu/PR

pythonsudeste.org

2 e 3 de setembro
Belo Horizonte/MG

pythonbrasil.org.br

13 a 18 de outubro
Florianópolis/SC

Curso de Python Online e Gratuito!

pythonic.cafe

Curso de Arduino em PoA!

cursodearduino.com.br/porto-alegre

19 a 22 de julho de 2016, TransLAB
CUPOM DE DESCONTO: FISL17

?

Obrigado! (:

Turicas aka Álvaro Justen

{twitter,
github,
youtube,
slideshare,
instagram}
/turicas

alvaro@CursoDeArduino.com.br

turicas.info

bit.ly/turicas-fisl17