SlideShare uma empresa Scribd logo
1 de 102
Baixar para ler offline
Python:
A
Arma Secreta
do
Cientista de Dados
Rodrigo Dias Arruda Senra
rsenra@acm.org
Apenas um rapaz latino americano...
Apenas um rapaz latino americano...
Apenas um rapaz latino americano...
• Engenheiro de Computação 

Grad-MSc-PhD IC-Unicamp
Apenas um rapaz latino americano...
• Engenheiro de Software 

• GPr Sistemas (11 anos)
• HI Tecnologia (5 anos)
• Engenheiro de Computação 

Grad-MSc-PhD IC-Unicamp
Apenas um rapaz latino americano...
• Engenheiro de Software 

• GPr Sistemas (11 anos)
• HI Tecnologia (5 anos)
• Professor Universitário - PUC-Campinas (2 anos)
• Engenheiro de Computação 

Grad-MSc-PhD IC-Unicamp
Apenas um rapaz latino americano...
• Engenheiro de Software 

• GPr Sistemas (11 anos)
• HI Tecnologia (5 anos)
• Professor Universitário - PUC-Campinas (2 anos)
• Especialista - globo.com (2 anos)
• Engenheiro de Computação 

Grad-MSc-PhD IC-Unicamp
Apenas um rapaz latino americano...
• Engenheiro de Software 

• GPr Sistemas (11 anos)
• HI Tecnologia (5 anos)
• Professor Universitário - PUC-Campinas (2 anos)
• Especialista - globo.com (2 anos)
• Cientista Pesquisador - EMC2
• Engenheiro de Computação 

Grad-MSc-PhD IC-Unicamp
Apenas um rapaz latino americano...
• Engenheiro de Software 

• GPr Sistemas (11 anos)
• HI Tecnologia (5 anos)
• Professor Universitário - PUC-Campinas (2 anos)
• Especialista - globo.com (2 anos)
• Cientista Pesquisador - EMC2
• Engenheiro de Computação 

Grad-MSc-PhD IC-Unicamp
• Entusiasta de FLOSS

(atuante na comunidade Python desde 2000)
Quem está aí ?
Quem está aí ?
• Estudantes ?
Quem está aí ?
• Estudantes ?
• Profissionais ?
Quem está aí ?
• Estudantes ?
• Profissionais ?
• Professores ?
Quem está aí ?
• Estudantes ?
• Profissionais ?
• Professores ?
• Palestrantes ?
Quem está aí ?
• Estudantes ?
• Profissionais ?
• Professores ?
• Palestrantes ?
• Pythonistas ?
Vamos falar do quê ?
• Cientista de Dados
• O Graal do desenvolvedor
• Escolhendo uma linguagem
• Contextualizando Python
• Vocabulário Ofidiglota
fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011
fonte: http://thehumanfaceofbigdata.com/
fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011
IN 2010 THE DIGITAL UNIVERSE WAS
1.2 ZETTABYTES
fonte: http://thehumanfaceofbigdata.com/
fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011
IN 2010 THE DIGITAL UNIVERSE WAS
1.2 ZETTABYTES
1,200,000,000,000,000,000,000
Zetta Exa Peta Tera Giga Mega Kilo Byte
fonte: http://thehumanfaceofbigdata.com/
fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011
2009

0.8 Zettabytes CRESCIMENTO
DA INFORMAÇÃO
2020
44
X
MAIOR
35.2 ZB
IN 2010 THE DIGITAL UNIVERSE WAS
1.2 ZETTABYTES
1,200,000,000,000,000,000,000
Zetta Exa Peta Tera Giga Mega Kilo Byte
fonte: http://thehumanfaceofbigdata.com/
fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011
2009

0.8 Zettabytes CRESCIMENTO
DA INFORMAÇÃO
2020
44
X
MAIOR
35.2 ZB
IN 2010 THE DIGITAL UNIVERSE WAS
1.2 ZETTABYTES
1,200,000,000,000,000,000,000
Zetta Exa Peta Tera Giga Mega Kilo Byte
fonte: http://thehumanfaceofbigdata.com/
http://www.telegraph.co.uk/news/picturegalleries/picturesoftheday/2545407/Pictures-of-the-day-12-August-2008.html?image=8
Cientista de Dados
Rodrigo Senra
O que faz ?
Quem é ?
Data Science is a newly emerging field dedicated to
analyzing and manipulating data to derive insights
and build data products.
https://beta.oreilly.com/ideas/what-is-data-science
It combines skill-sets ranging from
computer science, to mathematics, to art.
http://images.fineartamerica.com/images-medium-large-5/1-pi-transition-paths-martin-krzywinski.jpg
http://drewconway.com/
http://berkeleysciencereview.com/scientific-collaborations-uc-berkeley-data-driven-cover/
Estatísticas descritivas:
! Média vs. Mediana.
! Desvio Padrão
! Quartis, Min/Max.
! Correlação entre variavéis
Estatísticas descritivas:
! Média vs. Mediana.
! Desvio Padrão
! Quartis, Min/Max.
! Correlação entre variavéis
1
X y
10. 8.0
8.0 6.9
13. 7.5
9.0 8.8
11.0 8.3
14. 9.9
6.0 7.2
4.0 4.2
12. 10.
7.0 4.8
5.0 5.6
2
x y
10. 9.1
8.0 8.1
13. 8.7
9.0 8.7
11. 9.2
14. 8.1
6.0 6.1
4.0 3.1
12. 9.1
7.0 7.2
5.0 4.7
3
x y
10. 7.4
8.0 6.7
13. 12.
9.0 7.1
11. 7.8
14. 8.8
6.0 6.0
4.0 5.3
12. 8.1
7.0 6.4
5.0 5.7
4
x y
8.00 6.58
8.00 5.76
8.00 7.71
8.00 8.84
8.00 8.47
8.00 7.04
8.00 5.25
19.0 12.5
8.00 5.56
8.00 7.91
8.00 6.89
Estatísticas descritivas:
! Média vs. Mediana.
! Desvio Padrão
! Quartis, Min/Max.
! Correlação entre variavéis
1
X y
10. 8.0
8.0 6.9
13. 7.5
9.0 8.8
11.0 8.3
14. 9.9
6.0 7.2
4.0 4.2
12. 10.
7.0 4.8
5.0 5.6
2
x y
10. 9.1
8.0 8.1
13. 8.7
9.0 8.7
11. 9.2
14. 8.1
6.0 6.1
4.0 3.1
12. 9.1
7.0 7.2
5.0 4.7
3
x y
10. 7.4
8.0 6.7
13. 12.
9.0 7.1
11. 7.8
14. 8.8
6.0 6.0
4.0 5.3
12. 8.1
7.0 6.4
5.0 5.7
4
x y
8.00 6.58
8.00 5.76
8.00 7.71
8.00 8.84
8.00 8.47
8.00 7.04
8.00 5.25
19.0 12.5
8.00 5.56
8.00 7.91
8.00 6.89
Média de x: 9
Variância de x: 11
Média exata de y: 7.5 (2 d.p)
Variância de y: 4.13 (to 2 d.p)
Correlação entre x e y : 0.816
Regressão linear: Y = 3.00 + 0.500x
Estatísticas descritivas:
! Média vs. Mediana.
! Desvio Padrão
! Quartis, Min/Max.
! Correlação entre variavéis
1
X y
10. 8.0
8.0 6.9
13. 7.5
9.0 8.8
11.0 8.3
14. 9.9
6.0 7.2
4.0 4.2
12. 10.
7.0 4.8
5.0 5.6
2
x y
10. 9.1
8.0 8.1
13. 8.7
9.0 8.7
11. 9.2
14. 8.1
6.0 6.1
4.0 3.1
12. 9.1
7.0 7.2
5.0 4.7
3
x y
10. 7.4
8.0 6.7
13. 12.
9.0 7.1
11. 7.8
14. 8.8
6.0 6.0
4.0 5.3
12. 8.1
7.0 6.4
5.0 5.7
4
x y
8.00 6.58
8.00 5.76
8.00 7.71
8.00 8.84
8.00 8.47
8.00 7.04
8.00 5.25
19.0 12.5
8.00 5.56
8.00 7.91
8.00 6.89
Média de x: 9
Variância de x: 11
Média exata de y: 7.5 (2 d.p)
Variância de y: 4.13 (to 2 d.p)
Correlação entre x e y : 0.816
Regressão linear: Y = 3.00 + 0.500x
Estatísticas descritivas:
! Média vs. Mediana.
! Desvio Padrão
! Quartis, Min/Max.
! Correlação entre variavéis
1
X y
10. 8.0
8.0 6.9
13. 7.5
9.0 8.8
11.0 8.3
14. 9.9
6.0 7.2
4.0 4.2
12. 10.
7.0 4.8
5.0 5.6
2
x y
10. 9.1
8.0 8.1
13. 8.7
9.0 8.7
11. 9.2
14. 8.1
6.0 6.1
4.0 3.1
12. 9.1
7.0 7.2
5.0 4.7
3
x y
10. 7.4
8.0 6.7
13. 12.
9.0 7.1
11. 7.8
14. 8.8
6.0 6.0
4.0 5.3
12. 8.1
7.0 6.4
5.0 5.7
4
x y
8.00 6.58
8.00 5.76
8.00 7.71
8.00 8.84
8.00 8.47
8.00 7.04
8.00 5.25
19.0 12.5
8.00 5.56
8.00 7.91
8.00 6.89
Média de x: 9
Variância de x: 11
Média exata de y: 7.5 (2 d.p)
Variância de y: 4.13 (to 2 d.p)
Correlação entre x e y : 0.816
Regressão linear: Y = 3.00 + 0.500xTruth lies on statistics !
Big Data a cada passo da exploração de petróleo
Big Data a cada passo da exploração de petróleo
Navigation
Seismic: Pre-stack
Seismic: Post-stack
Log Curves
Culture Data
Geologic Model
Pressure Data
Velocity Data Interpretation
http://i0.wp.com/sciencereview.berkeley.edu/wp-content/uploads/2014/04/spring_2014_azam_05.jpg
Fernando Perez, lead PI at BIDS and creator of IPython, demonstrates brain imaging analyses
performed using the IPython Notebook, an interactive web-based computational environment.
credit: Peg Skorpinski
O Graal do Desenvolvedor
O Graal do Desenvolvedor
http://blog.jessitron.com/
A eterna busca pela
ferramenta perfeita
40
Plankalkü
Transistor
50
Fortran
LISP
Harddisk
Circuito
Integrado
60
COBOL
SIMULA
BASIC
LOGO
ITS
OS360
MULTICS
Mouse
Interrupções
Virt.Mem
ARPANET
RS-232
70
Pascal
C
Smalltalk
Prolog
UNIX
CP/M
VMS
Floppy
Micro-
processador
PONG
TCP/IP
Ethernet
80
Ada
C++
Perl
SQL
LISA
Macintosh
UNIX
MS-DOS
Windows
1.0-2.0
OS/2
MINIX
AIX
HPUX
SCO
GNU
RISC
90
Javascript
Python
Java
PHP
BeOS
Linux
Solaris
Windows
2.0 - 98
OpenBSD
ISA
WWW
2000
Scala
C#
Mac OSX
Windows
ME
2000
XP
Vista
7
Go
Linux
Julia
A verdade dói...
# Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm
A verdade dói...
# Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm
FORTRAN --"the infantile
disorder"--, by now nearly
20 years old, is hopelessly
inadequate for whatever
computer application
you have in mind today:
it is now too clumsy, too
risky, and too expensive to
use
A verdade dói...
# Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm
PL/1 --"the fatal
disease"-- belongs
more to the
problem set than to
the solution set
A verdade dói...
# Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm
It is practically impossible
to teach good
programming to students
that have had a prior
exposure to BASIC: as
potential programmers
they are mentally
mutilated beyond hope of
regeneration
A verdade dói...
# Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm
The use of COBOL
cripples the mind; its
teaching should,
therefore, be regarded as
a criminal offence
Truth lies on statistics!
Top 10 - SourceForge
Top 10 - SourceForge
http://githut.info/
Last data update: Fri Jul 24 20:03:26 BRT 2015
http://www.langpop.com
Yahoo Search, Craigslist, Ohloh, Google Code, Freshmeat, Delicious, Powells
http://sogrady-media.redmonk.com/sogrady/files/2015/07/lang-rank-615-wm.png
Segurança Fonte: http://nvd.nist.gov/nvd.cfm
Segurança Fonte: http://nvd.nist.gov/nvd.cfm
Python 91
Ruby 109
JS 209
Java 613
C 1559
PHP 2732
http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html
Duelo de linguagens
Duelo de linguagens
Duelo de linguagens
Duelo de linguagens
import java.io.*;
import java.util.*;
import java.text.*;
public class sumcol {
public static void main(String[] args) {
int count = 0;
String line;
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
while ((line = in.readLine()) != null) {
count = count + Integer.parseInt(line);
}
} catch (IOException e) { }
System.out.println(Integer.toString(count));
Java
import java.io.*;
import java.util.*;
import java.text.*;
public class sumcol {
public static void main(String[] args) {
int count = 0;
String line;
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
while ((line = in.readLine()) != null) {
count = count + Integer.parseInt(line);
}
} catch (IOException e) { }
System.out.println(Integer.toString(count));
Javausing System;
class App {
public static int Main(String[] args) {
int count = 0;
for (String line = Console.In.ReadLine();
line != null;
line = Console.In.ReadLine())
{ count += System.Convert.ToInt32(line); }
Console.WriteLine(count.ToString());
return(0);
}
C#
import java.io.*;
import java.util.*;
import java.text.*;
public class sumcol {
public static void main(String[] args) {
int count = 0;
String line;
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
while ((line = in.readLine()) != null) {
count = count + Integer.parseInt(line);
}
} catch (IOException e) { }
System.out.println(Integer.toString(count));
Javausing System;
class App {
public static int Main(String[] args) {
int count = 0;
for (String line = Console.In.ReadLine();
line != null;
line = Console.In.ReadLine())
{ count += System.Convert.ToInt32(line); }
Console.WriteLine(count.ToString());
return(0);
}
C#import sys
count = 0
while 1:
line = sys.stdin.readline().strip()
if not line:
break
count += int(line)
print count
Python
import java.io.*;
import java.util.*;
import java.text.*;
public class sumcol {
public static void main(String[] args) {
int count = 0;
String line;
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
while ((line = in.readLine()) != null) {
count = count + Integer.parseInt(line);
}
} catch (IOException e) { }
System.out.println(Integer.toString(count));
Javausing System;
class App {
public static int Main(String[] args) {
int count = 0;
for (String line = Console.In.ReadLine();
line != null;
line = Console.In.ReadLine())
{ count += System.Convert.ToInt32(line); }
Console.WriteLine(count.ToString());
return(0);
}
C#import sys
count = 0
while 1:
line = sys.stdin.readline().strip()
if not line:
break
count += int(line)
print count
Pythonimport sys, itertools
print sum(itertools.imap(int, sys.stdin))
Python
Python é ...
• propósito geral

• foco em produtividade do desenvolvedor

• multi-plataforma e multi-paradigma

• pilhas incluídas

• floss software

• fácil de extender e embutir

• madura (criada em1989, liberada ao público 1991)
Interoperabiilidade
✴ Jython (Python implementado em Java)

✴ CPython (onde existir compilador C ISO/IEC 9899:1990) 

✴ IronPython (implementado em C# pela M$)

✴ PyPy (Python implementado em... Python)

✴ Py4J (ponte entre CPython e JVM)

✴ Python for .NET [Brian Lloyd]

✴ Win32all [Mark Hammond] (adeus VBA!)

✴ PyObjC (Mac OSX middleware)

✴ Python for Delphi [Morgan Marat]

✴ LunaticPython [Gustavo Niemeyer] 

✴ Ruby/Python (importar módulos Python em Ruby)

✴ Python + Fortran
Hora da Demo
Dá tempo de ver
o Python em ação ?
É possível ?
Seria pedir muito ?
Pygame
Pygame
Python no celular S60
Python no celular S60
Bancos de Dados
from psycopg import *
o = connect(“ dbname=teste user=fulano” )
c = o.cursor()
c.execute(“ SELECT * FROM nome_da_tabela” )
row = c.fetchone()
print row
x = [ ('valor_1', 'fulano', 0), ('valor_2', 'beltrano', 5),
('valor_3', 'ciclano', 15)]
c.executemany(" " " INSERT INTO outra_tabela
VALUES (%s, %s, %s)""", x)
c.commit()
Networking
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
from time import asctime
class TimeServer(Protocol):
def dataReceived(self, data):
self.transport.write(asctime())
def main():
f = Factory()
f.protocol = TimeServer
reactor.listenTCP(8000, f)
reactor.run()
main()
Web Services
from SOAPpy import SOAPProxy
from SOAPpy import Types
google = SOAPProxy( 'http://api.google.com/search/beta2',
'urn:GoogleSearch')
results = google.doGetCachedPage('Pd6ke...ArQoX' ,
'www.owls.org')
of = open('cached_page_response.html', 'w')
of.write(results)
of.close()
SciPy
import view
from Numeric import *
x = arange(-3, 6, .04)
y = arange(-12, 12, .08)
y = sin(y)*exp(-y*y/18.0)
z = x * y[:,NewAxis]
view.view(z)
Referências
! http://python.org
! http://www.pythonbrasil.com.br
! http://associacao.pythonbrasil.org
! http://showmedo.com
Referências
! Fluent Python: Luciano Ramalho (O’Reilly)

! Python in a Nutshell: Alex Martelli (O'Reilly)

! Python Cookbook: Alex Martelli, David Ascher (O'Reilly)

! Learning Python for Interactive Computing and Data
Visualisation: Cyrille Rossant (Packt)
Conclusão
• Ágil, madura e moderna
• Fácil aprendizado
• Comunidade Ativa
• Fartura de documentação
• Divertida ;o)
Obrigado a todos
pela atenção.
Rodrigo Dias Arruda Senra
http://rodrigo.senra.nom.br
rodsenra@gmail.com
@rodsenra
As opiniões e conclusões expressas nesta apresentação são de exclusiva responsabilidade de Rodrigo Senra.
Não é necessário requisitar permissão do autor para o uso de partes ou do todo desta apresentação, desde que não sejam feitas
alterações no conteúdo reutilizado e que esta nota esteja presente na íntegra no material resultante.
Imagens e referências para outros trabalhos nesta apresentação permanecem propriedade daqueles que detêm seus direitos de
copyright. Agradecimento especial a Ana Oliveira e Diego Salomone que contribuíram com alguns slides de suas apresentações sobre
o mesmo tema.

Mais conteúdo relacionado

Destaque

Rupy2014 - Show Pyrotécnico
Rupy2014 - Show PyrotécnicoRupy2014 - Show Pyrotécnico
Rupy2014 - Show PyrotécnicoRodrigo Senra
 
Uma breve história no tempo...da computação
Uma breve história no tempo...da computaçãoUma breve história no tempo...da computação
Uma breve história no tempo...da computaçãoRodrigo Senra
 
Show Pyrotécnico - Keynote PythonBrasil[9] 2013
Show Pyrotécnico - Keynote PythonBrasil[9] 2013Show Pyrotécnico - Keynote PythonBrasil[9] 2013
Show Pyrotécnico - Keynote PythonBrasil[9] 2013Rodrigo Senra
 
pa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processingpa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text ProcessingRodrigo Senra
 
Organicer: Organizando informação com Python
Organicer: Organizando informação com PythonOrganicer: Organizando informação com Python
Organicer: Organizando informação com PythonRodrigo Senra
 
Tech talk about iswc2013
Tech talk about iswc2013Tech talk about iswc2013
Tech talk about iswc2013Rodrigo Senra
 
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Rodrigo Senra
 
Linked data at globo.com
Linked data at globo.comLinked data at globo.com
Linked data at globo.comRodrigo Senra
 
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)Rodrigo Senra
 
Brainiak - uma API REST Hipermedia
Brainiak - uma API REST Hipermedia Brainiak - uma API REST Hipermedia
Brainiak - uma API REST Hipermedia Rodrigo Senra
 
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...MAXfocus
 
Tim's Resume (2015) updated
Tim's Resume (2015) updatedTim's Resume (2015) updated
Tim's Resume (2015) updatedTim Bomgardner
 
Internet raffaella valluzzi
Internet raffaella valluzziInternet raffaella valluzzi
Internet raffaella valluzzimarianavigato0
 
Ist.Santo Domingo
Ist.Santo DomingoIst.Santo Domingo
Ist.Santo Domingojuan cherre
 
Sales management 8 2014 van verkopen naar co creatie
Sales management 8 2014 van verkopen naar co creatieSales management 8 2014 van verkopen naar co creatie
Sales management 8 2014 van verkopen naar co creatieAntwerp Management School
 

Destaque (19)

Rupy2014 - Show Pyrotécnico
Rupy2014 - Show PyrotécnicoRupy2014 - Show Pyrotécnico
Rupy2014 - Show Pyrotécnico
 
Uma breve história no tempo...da computação
Uma breve história no tempo...da computaçãoUma breve história no tempo...da computação
Uma breve história no tempo...da computação
 
Show Pyrotécnico - Keynote PythonBrasil[9] 2013
Show Pyrotécnico - Keynote PythonBrasil[9] 2013Show Pyrotécnico - Keynote PythonBrasil[9] 2013
Show Pyrotécnico - Keynote PythonBrasil[9] 2013
 
pa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processingpa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processing
 
Organicer: Organizando informação com Python
Organicer: Organizando informação com PythonOrganicer: Organizando informação com Python
Organicer: Organizando informação com Python
 
Tech talk about iswc2013
Tech talk about iswc2013Tech talk about iswc2013
Tech talk about iswc2013
 
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
 
Cientista de Dados
Cientista de DadosCientista de Dados
Cientista de Dados
 
Linked data at globo.com
Linked data at globo.comLinked data at globo.com
Linked data at globo.com
 
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
 
Brainiak - uma API REST Hipermedia
Brainiak - uma API REST Hipermedia Brainiak - uma API REST Hipermedia
Brainiak - uma API REST Hipermedia
 
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
Consolidating your Services Portfolio with GFI MAX - Jason Parsons and Steve ...
 
Tim's Resume (2015) updated
Tim's Resume (2015) updatedTim's Resume (2015) updated
Tim's Resume (2015) updated
 
Against Adoption of Homosexuality and For Defending the Institution of Family...
Against Adoption of Homosexuality and For Defending the Institution of Family...Against Adoption of Homosexuality and For Defending the Institution of Family...
Against Adoption of Homosexuality and For Defending the Institution of Family...
 
5.6 los amos de la red
5.6 los amos de la red5.6 los amos de la red
5.6 los amos de la red
 
Internet raffaella valluzzi
Internet raffaella valluzziInternet raffaella valluzzi
Internet raffaella valluzzi
 
13
1313
13
 
Ist.Santo Domingo
Ist.Santo DomingoIst.Santo Domingo
Ist.Santo Domingo
 
Sales management 8 2014 van verkopen naar co creatie
Sales management 8 2014 van verkopen naar co creatieSales management 8 2014 van verkopen naar co creatie
Sales management 8 2014 van verkopen naar co creatie
 

Semelhante a Python: a arma secreta do Cientista de Dados

Computação Grid e infra-estruturas para e-ciência
Computação Grid e infra-estruturas para e-ciênciaComputação Grid e infra-estruturas para e-ciência
Computação Grid e infra-estruturas para e-ciênciaLeandro Ciuffo
 
Wearables e Internet das Coisas
Wearables e Internet das CoisasWearables e Internet das Coisas
Wearables e Internet das CoisasLuís Leão
 
Conceitos Básicos INSS 2015
Conceitos Básicos INSS 2015Conceitos Básicos INSS 2015
Conceitos Básicos INSS 2015Veonaprovalogo
 
Monitoramento de Redes TCP/IP - Monografia
Monitoramento de Redes TCP/IP - MonografiaMonitoramento de Redes TCP/IP - Monografia
Monitoramento de Redes TCP/IP - MonografiaPietro Scherer
 
Se você é .NET, você é NETDUINO - TDC 2013 - Porto Alegre
Se você é .NET, você é NETDUINO - TDC 2013 - Porto AlegreSe você é .NET, você é NETDUINO - TDC 2013 - Porto Alegre
Se você é .NET, você é NETDUINO - TDC 2013 - Porto AlegreMarcio Martins
 
Informática e Windows
Informática e WindowsInformática e Windows
Informática e Windowsmarioreis
 
7 av tecnol. inform._2013_demo_p&b - sefaz-ms
7 av tecnol. inform._2013_demo_p&b - sefaz-ms7 av tecnol. inform._2013_demo_p&b - sefaz-ms
7 av tecnol. inform._2013_demo_p&b - sefaz-msKurte Wagner
 
Bigdata e NoSQL: buzzwords da teoria à prática
Bigdata e NoSQL: buzzwords da teoria à práticaBigdata e NoSQL: buzzwords da teoria à prática
Bigdata e NoSQL: buzzwords da teoria à práticaFabíola Fernandes
 
Apresentação #TDC2013 - Aplicações Profissionais com Radiuino
Apresentação #TDC2013 - Aplicações Profissionais com RadiuinoApresentação #TDC2013 - Aplicações Profissionais com Radiuino
Apresentação #TDC2013 - Aplicações Profissionais com RadiuinoOmar Branquinho
 
Centro Brasileiro de Pesquisas Físicas
Centro Brasileiro de Pesquisas FísicasCentro Brasileiro de Pesquisas Físicas
Centro Brasileiro de Pesquisas FísicasNIT Rio
 
Apresentação Tecnologia - 2012
Apresentação Tecnologia - 2012Apresentação Tecnologia - 2012
Apresentação Tecnologia - 2012Silvio Bogsan
 
IoT - Além da Telemetria
IoT - Além da TelemetriaIoT - Além da Telemetria
IoT - Além da TelemetriaAndré Curvello
 
TinyML - IoT e Machine Learning
TinyML -  IoT e Machine LearningTinyML -  IoT e Machine Learning
TinyML - IoT e Machine LearningAlvaro Viebrantz
 
Conceitos Básicos TRT 4 - 2015
Conceitos Básicos TRT 4 - 2015Conceitos Básicos TRT 4 - 2015
Conceitos Básicos TRT 4 - 2015Veonaprovalogo
 
Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...
Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...
Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...Embarcados
 

Semelhante a Python: a arma secreta do Cientista de Dados (20)

Computação Grid e infra-estruturas para e-ciência
Computação Grid e infra-estruturas para e-ciênciaComputação Grid e infra-estruturas para e-ciência
Computação Grid e infra-estruturas para e-ciência
 
Tdc
TdcTdc
Tdc
 
Bigadata casese opotunidades
Bigadata casese opotunidadesBigadata casese opotunidades
Bigadata casese opotunidades
 
Oficina kinect
Oficina kinectOficina kinect
Oficina kinect
 
Wearables e Internet das Coisas
Wearables e Internet das CoisasWearables e Internet das Coisas
Wearables e Internet das Coisas
 
Conceitos Básicos INSS 2015
Conceitos Básicos INSS 2015Conceitos Básicos INSS 2015
Conceitos Básicos INSS 2015
 
Internet das coisas
Internet das coisasInternet das coisas
Internet das coisas
 
Monitoramento de Redes TCP/IP - Monografia
Monitoramento de Redes TCP/IP - MonografiaMonitoramento de Redes TCP/IP - Monografia
Monitoramento de Redes TCP/IP - Monografia
 
Se você é .NET, você é NETDUINO - TDC 2013 - Porto Alegre
Se você é .NET, você é NETDUINO - TDC 2013 - Porto AlegreSe você é .NET, você é NETDUINO - TDC 2013 - Porto Alegre
Se você é .NET, você é NETDUINO - TDC 2013 - Porto Alegre
 
Informática e Windows
Informática e WindowsInformática e Windows
Informática e Windows
 
7 av tecnol. inform._2013_demo_p&b - sefaz-ms
7 av tecnol. inform._2013_demo_p&b - sefaz-ms7 av tecnol. inform._2013_demo_p&b - sefaz-ms
7 av tecnol. inform._2013_demo_p&b - sefaz-ms
 
Bigdata e NoSQL: buzzwords da teoria à prática
Bigdata e NoSQL: buzzwords da teoria à práticaBigdata e NoSQL: buzzwords da teoria à prática
Bigdata e NoSQL: buzzwords da teoria à prática
 
Apresentação #TDC2013 - Aplicações Profissionais com Radiuino
Apresentação #TDC2013 - Aplicações Profissionais com RadiuinoApresentação #TDC2013 - Aplicações Profissionais com Radiuino
Apresentação #TDC2013 - Aplicações Profissionais com Radiuino
 
Centro Brasileiro de Pesquisas Físicas
Centro Brasileiro de Pesquisas FísicasCentro Brasileiro de Pesquisas Físicas
Centro Brasileiro de Pesquisas Físicas
 
Apresentação Tecnologia - 2012
Apresentação Tecnologia - 2012Apresentação Tecnologia - 2012
Apresentação Tecnologia - 2012
 
IoT - Além da Telemetria
IoT - Além da TelemetriaIoT - Além da Telemetria
IoT - Além da Telemetria
 
Bridges Virtuais
Bridges VirtuaisBridges Virtuais
Bridges Virtuais
 
TinyML - IoT e Machine Learning
TinyML -  IoT e Machine LearningTinyML -  IoT e Machine Learning
TinyML - IoT e Machine Learning
 
Conceitos Básicos TRT 4 - 2015
Conceitos Básicos TRT 4 - 2015Conceitos Básicos TRT 4 - 2015
Conceitos Básicos TRT 4 - 2015
 
Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...
Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...
Webinar: Desvendando o seguidor de linha: sensores, montagem e programação co...
 

Python: a arma secreta do Cientista de Dados

  • 1. Python: A Arma Secreta do Cientista de Dados Rodrigo Dias Arruda Senra rsenra@acm.org
  • 2. Apenas um rapaz latino americano...
  • 3. Apenas um rapaz latino americano...
  • 4. Apenas um rapaz latino americano... • Engenheiro de Computação Grad-MSc-PhD IC-Unicamp
  • 5. Apenas um rapaz latino americano... • Engenheiro de Software • GPr Sistemas (11 anos) • HI Tecnologia (5 anos) • Engenheiro de Computação Grad-MSc-PhD IC-Unicamp
  • 6. Apenas um rapaz latino americano... • Engenheiro de Software • GPr Sistemas (11 anos) • HI Tecnologia (5 anos) • Professor Universitário - PUC-Campinas (2 anos) • Engenheiro de Computação Grad-MSc-PhD IC-Unicamp
  • 7. Apenas um rapaz latino americano... • Engenheiro de Software • GPr Sistemas (11 anos) • HI Tecnologia (5 anos) • Professor Universitário - PUC-Campinas (2 anos) • Especialista - globo.com (2 anos) • Engenheiro de Computação Grad-MSc-PhD IC-Unicamp
  • 8. Apenas um rapaz latino americano... • Engenheiro de Software • GPr Sistemas (11 anos) • HI Tecnologia (5 anos) • Professor Universitário - PUC-Campinas (2 anos) • Especialista - globo.com (2 anos) • Cientista Pesquisador - EMC2 • Engenheiro de Computação Grad-MSc-PhD IC-Unicamp
  • 9. Apenas um rapaz latino americano... • Engenheiro de Software • GPr Sistemas (11 anos) • HI Tecnologia (5 anos) • Professor Universitário - PUC-Campinas (2 anos) • Especialista - globo.com (2 anos) • Cientista Pesquisador - EMC2 • Engenheiro de Computação Grad-MSc-PhD IC-Unicamp • Entusiasta de FLOSS (atuante na comunidade Python desde 2000)
  • 11. Quem está aí ? • Estudantes ?
  • 12. Quem está aí ? • Estudantes ? • Profissionais ?
  • 13. Quem está aí ? • Estudantes ? • Profissionais ? • Professores ?
  • 14. Quem está aí ? • Estudantes ? • Profissionais ? • Professores ? • Palestrantes ?
  • 15. Quem está aí ? • Estudantes ? • Profissionais ? • Professores ? • Palestrantes ? • Pythonistas ?
  • 16. Vamos falar do quê ? • Cientista de Dados • O Graal do desenvolvedor • Escolhendo uma linguagem • Contextualizando Python • Vocabulário Ofidiglota
  • 17. fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011 fonte: http://thehumanfaceofbigdata.com/
  • 18. fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011 IN 2010 THE DIGITAL UNIVERSE WAS 1.2 ZETTABYTES fonte: http://thehumanfaceofbigdata.com/
  • 19. fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011 IN 2010 THE DIGITAL UNIVERSE WAS 1.2 ZETTABYTES 1,200,000,000,000,000,000,000 Zetta Exa Peta Tera Giga Mega Kilo Byte fonte: http://thehumanfaceofbigdata.com/
  • 20. fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011 2009
 0.8 Zettabytes CRESCIMENTO DA INFORMAÇÃO 2020 44 X MAIOR 35.2 ZB IN 2010 THE DIGITAL UNIVERSE WAS 1.2 ZETTABYTES 1,200,000,000,000,000,000,000 Zetta Exa Peta Tera Giga Mega Kilo Byte fonte: http://thehumanfaceofbigdata.com/
  • 21. fONTE: IDC Digital Universe Study, patrocinado pela EMC, 2011 2009
 0.8 Zettabytes CRESCIMENTO DA INFORMAÇÃO 2020 44 X MAIOR 35.2 ZB IN 2010 THE DIGITAL UNIVERSE WAS 1.2 ZETTABYTES 1,200,000,000,000,000,000,000 Zetta Exa Peta Tera Giga Mega Kilo Byte fonte: http://thehumanfaceofbigdata.com/
  • 22.
  • 24. Cientista de Dados Rodrigo Senra O que faz ? Quem é ?
  • 25. Data Science is a newly emerging field dedicated to analyzing and manipulating data to derive insights and build data products. https://beta.oreilly.com/ideas/what-is-data-science It combines skill-sets ranging from computer science, to mathematics, to art. http://images.fineartamerica.com/images-medium-large-5/1-pi-transition-paths-martin-krzywinski.jpg
  • 26.
  • 29. Estatísticas descritivas: ! Média vs. Mediana. ! Desvio Padrão ! Quartis, Min/Max. ! Correlação entre variavéis
  • 30. Estatísticas descritivas: ! Média vs. Mediana. ! Desvio Padrão ! Quartis, Min/Max. ! Correlação entre variavéis 1 X y 10. 8.0 8.0 6.9 13. 7.5 9.0 8.8 11.0 8.3 14. 9.9 6.0 7.2 4.0 4.2 12. 10. 7.0 4.8 5.0 5.6 2 x y 10. 9.1 8.0 8.1 13. 8.7 9.0 8.7 11. 9.2 14. 8.1 6.0 6.1 4.0 3.1 12. 9.1 7.0 7.2 5.0 4.7 3 x y 10. 7.4 8.0 6.7 13. 12. 9.0 7.1 11. 7.8 14. 8.8 6.0 6.0 4.0 5.3 12. 8.1 7.0 6.4 5.0 5.7 4 x y 8.00 6.58 8.00 5.76 8.00 7.71 8.00 8.84 8.00 8.47 8.00 7.04 8.00 5.25 19.0 12.5 8.00 5.56 8.00 7.91 8.00 6.89
  • 31. Estatísticas descritivas: ! Média vs. Mediana. ! Desvio Padrão ! Quartis, Min/Max. ! Correlação entre variavéis 1 X y 10. 8.0 8.0 6.9 13. 7.5 9.0 8.8 11.0 8.3 14. 9.9 6.0 7.2 4.0 4.2 12. 10. 7.0 4.8 5.0 5.6 2 x y 10. 9.1 8.0 8.1 13. 8.7 9.0 8.7 11. 9.2 14. 8.1 6.0 6.1 4.0 3.1 12. 9.1 7.0 7.2 5.0 4.7 3 x y 10. 7.4 8.0 6.7 13. 12. 9.0 7.1 11. 7.8 14. 8.8 6.0 6.0 4.0 5.3 12. 8.1 7.0 6.4 5.0 5.7 4 x y 8.00 6.58 8.00 5.76 8.00 7.71 8.00 8.84 8.00 8.47 8.00 7.04 8.00 5.25 19.0 12.5 8.00 5.56 8.00 7.91 8.00 6.89 Média de x: 9 Variância de x: 11 Média exata de y: 7.5 (2 d.p) Variância de y: 4.13 (to 2 d.p) Correlação entre x e y : 0.816 Regressão linear: Y = 3.00 + 0.500x
  • 32. Estatísticas descritivas: ! Média vs. Mediana. ! Desvio Padrão ! Quartis, Min/Max. ! Correlação entre variavéis 1 X y 10. 8.0 8.0 6.9 13. 7.5 9.0 8.8 11.0 8.3 14. 9.9 6.0 7.2 4.0 4.2 12. 10. 7.0 4.8 5.0 5.6 2 x y 10. 9.1 8.0 8.1 13. 8.7 9.0 8.7 11. 9.2 14. 8.1 6.0 6.1 4.0 3.1 12. 9.1 7.0 7.2 5.0 4.7 3 x y 10. 7.4 8.0 6.7 13. 12. 9.0 7.1 11. 7.8 14. 8.8 6.0 6.0 4.0 5.3 12. 8.1 7.0 6.4 5.0 5.7 4 x y 8.00 6.58 8.00 5.76 8.00 7.71 8.00 8.84 8.00 8.47 8.00 7.04 8.00 5.25 19.0 12.5 8.00 5.56 8.00 7.91 8.00 6.89 Média de x: 9 Variância de x: 11 Média exata de y: 7.5 (2 d.p) Variância de y: 4.13 (to 2 d.p) Correlação entre x e y : 0.816 Regressão linear: Y = 3.00 + 0.500x
  • 33. Estatísticas descritivas: ! Média vs. Mediana. ! Desvio Padrão ! Quartis, Min/Max. ! Correlação entre variavéis 1 X y 10. 8.0 8.0 6.9 13. 7.5 9.0 8.8 11.0 8.3 14. 9.9 6.0 7.2 4.0 4.2 12. 10. 7.0 4.8 5.0 5.6 2 x y 10. 9.1 8.0 8.1 13. 8.7 9.0 8.7 11. 9.2 14. 8.1 6.0 6.1 4.0 3.1 12. 9.1 7.0 7.2 5.0 4.7 3 x y 10. 7.4 8.0 6.7 13. 12. 9.0 7.1 11. 7.8 14. 8.8 6.0 6.0 4.0 5.3 12. 8.1 7.0 6.4 5.0 5.7 4 x y 8.00 6.58 8.00 5.76 8.00 7.71 8.00 8.84 8.00 8.47 8.00 7.04 8.00 5.25 19.0 12.5 8.00 5.56 8.00 7.91 8.00 6.89 Média de x: 9 Variância de x: 11 Média exata de y: 7.5 (2 d.p) Variância de y: 4.13 (to 2 d.p) Correlação entre x e y : 0.816 Regressão linear: Y = 3.00 + 0.500xTruth lies on statistics !
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42. Big Data a cada passo da exploração de petróleo
  • 43. Big Data a cada passo da exploração de petróleo Navigation Seismic: Pre-stack Seismic: Post-stack Log Curves Culture Data Geologic Model Pressure Data Velocity Data Interpretation
  • 45.
  • 46.
  • 47. Fernando Perez, lead PI at BIDS and creator of IPython, demonstrates brain imaging analyses performed using the IPython Notebook, an interactive web-based computational environment. credit: Peg Skorpinski
  • 48.
  • 49. O Graal do Desenvolvedor
  • 50. O Graal do Desenvolvedor http://blog.jessitron.com/
  • 51. A eterna busca pela ferramenta perfeita
  • 52.
  • 53.
  • 54.
  • 56. A verdade dói... # Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm
  • 57. A verdade dói... # Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm FORTRAN --"the infantile disorder"--, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use
  • 58. A verdade dói... # Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm PL/1 --"the fatal disease"-- belongs more to the problem set than to the solution set
  • 59. A verdade dói... # Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration
  • 60. A verdade dói... # Edsger W.Dijkstra, 18 Junho 1975 http://www.cbi.umn.edu/inv/burros/ewd498.htm The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence
  • 61. Truth lies on statistics!
  • 62.
  • 63. Top 10 - SourceForge
  • 64. Top 10 - SourceForge
  • 66. Last data update: Fri Jul 24 20:03:26 BRT 2015 http://www.langpop.com Yahoo Search, Craigslist, Ohloh, Google Code, Freshmeat, Delicious, Powells
  • 68.
  • 69.
  • 70.
  • 71.
  • 73. Segurança Fonte: http://nvd.nist.gov/nvd.cfm Python 91 Ruby 109 JS 209 Java 613 C 1559 PHP 2732
  • 79.
  • 80. import java.io.*; import java.util.*; import java.text.*; public class sumcol { public static void main(String[] args) { int count = 0; String line; try { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); while ((line = in.readLine()) != null) { count = count + Integer.parseInt(line); } } catch (IOException e) { } System.out.println(Integer.toString(count)); Java
  • 81. import java.io.*; import java.util.*; import java.text.*; public class sumcol { public static void main(String[] args) { int count = 0; String line; try { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); while ((line = in.readLine()) != null) { count = count + Integer.parseInt(line); } } catch (IOException e) { } System.out.println(Integer.toString(count)); Javausing System; class App { public static int Main(String[] args) { int count = 0; for (String line = Console.In.ReadLine(); line != null; line = Console.In.ReadLine()) { count += System.Convert.ToInt32(line); } Console.WriteLine(count.ToString()); return(0); } C#
  • 82. import java.io.*; import java.util.*; import java.text.*; public class sumcol { public static void main(String[] args) { int count = 0; String line; try { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); while ((line = in.readLine()) != null) { count = count + Integer.parseInt(line); } } catch (IOException e) { } System.out.println(Integer.toString(count)); Javausing System; class App { public static int Main(String[] args) { int count = 0; for (String line = Console.In.ReadLine(); line != null; line = Console.In.ReadLine()) { count += System.Convert.ToInt32(line); } Console.WriteLine(count.ToString()); return(0); } C#import sys count = 0 while 1: line = sys.stdin.readline().strip() if not line: break count += int(line) print count Python
  • 83. import java.io.*; import java.util.*; import java.text.*; public class sumcol { public static void main(String[] args) { int count = 0; String line; try { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); while ((line = in.readLine()) != null) { count = count + Integer.parseInt(line); } } catch (IOException e) { } System.out.println(Integer.toString(count)); Javausing System; class App { public static int Main(String[] args) { int count = 0; for (String line = Console.In.ReadLine(); line != null; line = Console.In.ReadLine()) { count += System.Convert.ToInt32(line); } Console.WriteLine(count.ToString()); return(0); } C#import sys count = 0 while 1: line = sys.stdin.readline().strip() if not line: break count += int(line) print count Pythonimport sys, itertools print sum(itertools.imap(int, sys.stdin)) Python
  • 84. Python é ... • propósito geral • foco em produtividade do desenvolvedor • multi-plataforma e multi-paradigma • pilhas incluídas • floss software • fácil de extender e embutir • madura (criada em1989, liberada ao público 1991)
  • 85. Interoperabiilidade ✴ Jython (Python implementado em Java) ✴ CPython (onde existir compilador C ISO/IEC 9899:1990) ✴ IronPython (implementado em C# pela M$) ✴ PyPy (Python implementado em... Python) ✴ Py4J (ponte entre CPython e JVM) ✴ Python for .NET [Brian Lloyd] ✴ Win32all [Mark Hammond] (adeus VBA!) ✴ PyObjC (Mac OSX middleware) ✴ Python for Delphi [Morgan Marat] ✴ LunaticPython [Gustavo Niemeyer] ✴ Ruby/Python (importar módulos Python em Ruby) ✴ Python + Fortran
  • 86. Hora da Demo Dá tempo de ver o Python em ação ? É possível ? Seria pedir muito ?
  • 91. Bancos de Dados from psycopg import * o = connect(“ dbname=teste user=fulano” ) c = o.cursor() c.execute(“ SELECT * FROM nome_da_tabela” ) row = c.fetchone() print row x = [ ('valor_1', 'fulano', 0), ('valor_2', 'beltrano', 5), ('valor_3', 'ciclano', 15)] c.executemany(" " " INSERT INTO outra_tabela VALUES (%s, %s, %s)""", x) c.commit()
  • 92. Networking from twisted.internet.protocol import Protocol, Factory from twisted.internet import reactor from time import asctime class TimeServer(Protocol): def dataReceived(self, data): self.transport.write(asctime()) def main(): f = Factory() f.protocol = TimeServer reactor.listenTCP(8000, f) reactor.run() main()
  • 93. Web Services from SOAPpy import SOAPProxy from SOAPpy import Types google = SOAPProxy( 'http://api.google.com/search/beta2', 'urn:GoogleSearch') results = google.doGetCachedPage('Pd6ke...ArQoX' , 'www.owls.org') of = open('cached_page_response.html', 'w') of.write(results) of.close()
  • 94. SciPy import view from Numeric import * x = arange(-3, 6, .04) y = arange(-12, 12, .08) y = sin(y)*exp(-y*y/18.0) z = x * y[:,NewAxis] view.view(z)
  • 95. Referências ! http://python.org ! http://www.pythonbrasil.com.br ! http://associacao.pythonbrasil.org ! http://showmedo.com
  • 96. Referências ! Fluent Python: Luciano Ramalho (O’Reilly) ! Python in a Nutshell: Alex Martelli (O'Reilly) ! Python Cookbook: Alex Martelli, David Ascher (O'Reilly) ! Learning Python for Interactive Computing and Data Visualisation: Cyrille Rossant (Packt)
  • 97. Conclusão • Ágil, madura e moderna • Fácil aprendizado • Comunidade Ativa • Fartura de documentação • Divertida ;o)
  • 98.
  • 99.
  • 100.
  • 101.
  • 102. Obrigado a todos pela atenção. Rodrigo Dias Arruda Senra http://rodrigo.senra.nom.br rodsenra@gmail.com @rodsenra As opiniões e conclusões expressas nesta apresentação são de exclusiva responsabilidade de Rodrigo Senra. Não é necessário requisitar permissão do autor para o uso de partes ou do todo desta apresentação, desde que não sejam feitas alterações no conteúdo reutilizado e que esta nota esteja presente na íntegra no material resultante. Imagens e referências para outros trabalhos nesta apresentação permanecem propriedade daqueles que detêm seus direitos de copyright. Agradecimento especial a Ana Oliveira e Diego Salomone que contribuíram com alguns slides de suas apresentações sobre o mesmo tema.