SlideShare a Scribd company logo
1 of 16
Download to read offline
LEZIONE 1..
PYTHON BASE
PARTE 2: strutture dati di base: liste e
dizionari; primi moduli: os, sys, numpy.
Lezione precedente
interi, floating
point, decimal
ATTRIBUTI
METODI
OGGETTO
CLASSE
funzioni
built-in
stringhe
ITERABLE
print
len
int float
str
list set
.replace
.upper
.count
if elif else for .. in .. :
COME
ORGANIZ-
ZARE I
DATI
100 324.3 ‘Italia’
533 ‘FRA’ ‘Oggi è
una bella giornata’
54.5 True 57 987
False ‘DEU’
‘config.py’
CONSIDERIAMO UNA SERIE STORICA MENSILE
maggio 2015 125.6
giugno 2015 128.3
luglio 2015 132.9
agosto 2015 133.1
settembre 2015 135.5
ottobre 2015 135.2
novembre 2015 138.6
[
125.6,
128.3,
132.9,
133.1,
135.5,
135.2,
138.6
]
DIZIONARIO
{
’201501’ : 125.6,
‘201506’ : 128.3,
‘201507’ : 132.9,
‘201508’ : 133.1 ,
‘201509’ : 135.5,
‘201510’ : 135.2,
‘201511’ : 138.6
}
LISTA
[
125.6,
128.3,
132.9,
133.1,
135.5,
135.2,
138.6
]
DIZIONARIO
{
’201501’ : 125.6,
‘201506’ : 128.3,
‘201507’ : 132.9,
‘201508’ : 133.1 ,
‘201509’ : 135.5,
‘201510’ : 135.2,
‘201511’ : 138.6
}
LISTA
posizione 0
posizione 1
posizione 2
posizione 3
posizione 4
posizione 5
posizione 6
chiave
chiave
chiave
chiave
chiave
chiave
chiave
Assegnazione
LIS1 = [ 125.6, 128.3,
132.9, 133.1, 135.5,
135.2, 138.6 ]
DIZIONARIO
Assegnazione
DIZ1 = {
’201501’ : 125.6,
‘201506’ : 128.3,
‘201507’ : 132.9,
‘201508’ : 133.1 ,
‘201509’ : 135.5,
‘201510’ : 135.2,
‘201511’ : 138.6
}
LISTA
Estrazione
LIS1 [3]
LIS1 [1:3]
LIS1 [:3]
DIZIONARIO
Estrazione
DIZ1 [‘201508’]
LISTA
LEZIONE 1..
www.fordatascientist.org
B00-PyBase
B31-Data-Structures-Builtin
LEZIONE 1..
www.fordatascientist.org
B00-PyBase
B32-Data-Structures-Other
[ ]
{ }( )
Data Built-in Data Module
numpy
pandas.Array
.Series.max()
.mean()
.Ndarray
.std()
.mean(axis=1)
.DataFrame
.index
.index
.columns
.index()
.count()
.count()
.keys
.sort()
.append()
.remove()
LEZIONE 1..
www.fordatascientist.org
B00-PyBase
B36-Slicing-Iterable.ipynb
[ ]ESTRATTORE
tupla lista Array
Ndarray
Series
DataFrame
iloc()
A cosa servono le tuple
A= { (‘FRA’,’DEU’,’2015’): 765,
(‘FRA’,’ITA’,’2015’): 234,
(‘FRA’,’USA’,’2015’): 122,
(‘DEU’,’FRA’,’2016’): 975,
(‘DEU’,’ITA’,’2016’): 744,
(‘DEU’,’USA’,’2016’): 865 }
A= {‘FRA’:{’DEU’:{’2015’: 765},
’ITA’:{’2015’: 234},
’USA’:{’2015’: 122} },
‘DEU’:{’FRA’:{’2016’: 975},
’ITA’:{’2016’: 744},
‘USA’:{‘2016’: 865} }
}
Nel 2015, la Francia ha esportato verso la Germania 875 milioni di euro; verso l’Italia 234 mln di euro;
verso gli Stati Uniti 122 mln di euro;
Nel 2016, la Germania ha esportato verso la Francia 975 milioni di euro; verso l’Italia 744; verso gli
Stati Uniti 865
A['FRA']['ITA']['2015'] A [ ('FRA','ITA','2015') ]
COSTRUZIONE
ESTRAZIONE
LEZIONE 1..
www.fordatascientist.org
B00-PyBase
B53-Custom-Function
CONTATTI TELEFONO
051 22 35 20
EMAIL
WORKSHOP@VICEM.IT

More Related Content

Viewers also liked

"Teacher Inovator" contest Winner!
"Teacher Inovator" contest Winner!"Teacher Inovator" contest Winner!
"Teacher Inovator" contest Winner!bilimland
 
โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์ โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์ Channarong_13383
 
Global factors that are shaping UK business activity assignment 2 task 2
Global factors that are shaping UK business activity assignment 2 task 2Global factors that are shaping UK business activity assignment 2 task 2
Global factors that are shaping UK business activity assignment 2 task 2John Brian Lee
 

Viewers also liked (10)

Algeria
AlgeriaAlgeria
Algeria
 
The T in LGBT
The T in LGBTThe T in LGBT
The T in LGBT
 
Colorado Highlands2IEA
Colorado Highlands2IEAColorado Highlands2IEA
Colorado Highlands2IEA
 
Inspiration
InspirationInspiration
Inspiration
 
Colorado Highlands IEA
Colorado Highlands IEAColorado Highlands IEA
Colorado Highlands IEA
 
"Teacher Inovator" contest Winner!
"Teacher Inovator" contest Winner!"Teacher Inovator" contest Winner!
"Teacher Inovator" contest Winner!
 
โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์ โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์
 
Requsition user menual
Requsition user menualRequsition user menual
Requsition user menual
 
Celulita
CelulitaCelulita
Celulita
 
Global factors that are shaping UK business activity assignment 2 task 2
Global factors that are shaping UK business activity assignment 2 task 2Global factors that are shaping UK business activity assignment 2 task 2
Global factors that are shaping UK business activity assignment 2 task 2
 

More from Annalisa Vignoli

Web base - Javascript (Node.js): Elementi di base
Web base - Javascript (Node.js): Elementi di baseWeb base - Javascript (Node.js): Elementi di base
Web base - Javascript (Node.js): Elementi di baseAnnalisa Vignoli
 
Web base - CSS e selettori
Web base - CSS e selettoriWeb base - CSS e selettori
Web base - CSS e selettoriAnnalisa Vignoli
 
WEB BASE - Una visione d'insieme delle tecnologie web
WEB BASE - Una visione d'insieme delle tecnologie webWEB BASE - Una visione d'insieme delle tecnologie web
WEB BASE - Una visione d'insieme delle tecnologie webAnnalisa Vignoli
 
Presentazione Ulisse - Rame
Presentazione Ulisse - RamePresentazione Ulisse - Rame
Presentazione Ulisse - RameAnnalisa Vignoli
 
Presentazione Ulisse - Acciaio
Presentazione Ulisse - AcciaioPresentazione Ulisse - Acciaio
Presentazione Ulisse - AcciaioAnnalisa Vignoli
 
Fordascientist - Python reportlab
Fordascientist - Python reportlabFordascientist - Python reportlab
Fordascientist - Python reportlabAnnalisa Vignoli
 
ForDataScientist - Python matplotlib
ForDataScientist - Python matplotlibForDataScientist - Python matplotlib
ForDataScientist - Python matplotlibAnnalisa Vignoli
 
ForDataScientist - Python advanced data
ForDataScientist - Python advanced dataForDataScientist - Python advanced data
ForDataScientist - Python advanced dataAnnalisa Vignoli
 
ForDataScientist - Python base parte1
ForDataScientist - Python base parte1ForDataScientist - Python base parte1
ForDataScientist - Python base parte1Annalisa Vignoli
 

More from Annalisa Vignoli (18)

Presentazione Corsi FDS
Presentazione Corsi FDSPresentazione Corsi FDS
Presentazione Corsi FDS
 
Python base lezione 5
Python base lezione 5Python base lezione 5
Python base lezione 5
 
Python base lezione 4
Python base lezione 4Python base lezione 4
Python base lezione 4
 
Python base lezione 3
Python base lezione 3Python base lezione 3
Python base lezione 3
 
Python base lezione 2
Python base lezione 2Python base lezione 2
Python base lezione 2
 
Python base lezione1
Python base lezione1Python base lezione1
Python base lezione1
 
Web base - Javascript (Node.js): Elementi di base
Web base - Javascript (Node.js): Elementi di baseWeb base - Javascript (Node.js): Elementi di base
Web base - Javascript (Node.js): Elementi di base
 
Web base - SVG
Web base - SVGWeb base - SVG
Web base - SVG
 
Web base - CSS e selettori
Web base - CSS e selettoriWeb base - CSS e selettori
Web base - CSS e selettori
 
Web base - HTML
Web base - HTMLWeb base - HTML
Web base - HTML
 
WEB BASE - Una visione d'insieme delle tecnologie web
WEB BASE - Una visione d'insieme delle tecnologie webWEB BASE - Una visione d'insieme delle tecnologie web
WEB BASE - Una visione d'insieme delle tecnologie web
 
Presentazione Ulisse - Rame
Presentazione Ulisse - RamePresentazione Ulisse - Rame
Presentazione Ulisse - Rame
 
Presentazione Ulisse - Acciaio
Presentazione Ulisse - AcciaioPresentazione Ulisse - Acciaio
Presentazione Ulisse - Acciaio
 
Fordascientist - Python reportlab
Fordascientist - Python reportlabFordascientist - Python reportlab
Fordascientist - Python reportlab
 
ForDataScientist - Python matplotlib
ForDataScientist - Python matplotlibForDataScientist - Python matplotlib
ForDataScientist - Python matplotlib
 
ForDataScientist - Python advanced data
ForDataScientist - Python advanced dataForDataScientist - Python advanced data
ForDataScientist - Python advanced data
 
ForDataScientist - Python base parte1
ForDataScientist - Python base parte1ForDataScientist - Python base parte1
ForDataScientist - Python base parte1
 
abstract_tesi
abstract_tesiabstract_tesi
abstract_tesi
 

ForDataScientist - Python base parte2