Corso Data Journalist gen-mar 2017
PYTHON ADVANCED
Dalle liste ai dataframe
Built -in
Mappa sinottica: Strutture dati
Classe Costruttore
list [ ]
dict { }
Modulo numpy
Classe Costruttore
ndarray array
ndarray
matrixlib.
defmatrix.
matrix
matrix
Modulo pandas
Classe Costruttore
Index Index
Multindex Multindex
Series Series
DataFrame DataFrame
Panel4D Panel4D
Panel Panel
list
Confronto tra list, array, Index
- NO
array
+ somma
Index
somma+ concatena
- sottraz.
+
Stringhe
Numeri
unione
* concatena * moltiplica
sottraz.-
Stringhe
Numeri
esclus.
moltiplica* Numeri
divide/ Numeri/ divide/ NO
list
Confronto tra list, array, Index
array
numpy.append( A1, A2)
Index
.append() (in-place) .append(..) (out-of-place)
.sort() (in-place)
numpy.sort( A1)
.sort (in-place)
.remove(..) (in-place) numpy.delete(A1, ..) .delete(...) (out-of-place)
= (nuova var; stesso obj.) (nuova var; stesso obj.)= = (nuovo oggetto)
Metodi per l’analisi statistica
(ad esempio, mean())
Metodi per l’analisi statistica
(ad esempio, mean())
Metodi per raggruppamenti e
per trasformazioni
LEZIONE 1..
www.fordatascientist.org
E00-PyData
E02-Numpy.ipynb
Series e Dataframe
Series
Una Series è una classe pandas che può essere
vista come un dizionario, in cui la chiave è data
dall’indice della serie
{ 1: 100,
2: 120,
3: 132,
4: 131,
5 127 }
Una volta istanziato esiste una relazione
fissa tra indice (chiave) e valore. Diversamente da
quanto avviene per una lista (array, Index), se si
estrae una slice non viene modificata la relazione
tra indice e valore
DataFrame
Un DataFrame è una classe pandas che può
essere vista come un dizionario di Liste/Series, in
cui la chiave identifica una Lista/Series.
{ ‘V1’: [ 100, 120, 132, 131, 127],
‘V2’: [ 132, 176, 232, 243, 457]
}
Ogni colonna di una DataFrame è identificata da
una variabile. La lista di queste variabili forma
l’attributo .columns
Ogni riga di un DataFrame è identificata da un
indice, assegnato all’attributo index. Questo indice
è un oggetto della classe Index del modulo
pandas.
Liste
[ , , , ]
Dizionari
{ : , : , }
Tuple
( , , , )
Set
{ , , , }
Mappa sinottica Strutture Dati
array e ndarray
(statistica)
matrix
(matrici)
Index
(array+set)
MultiIndex
(Index+tuple)
Series
(1 Index/M.
+ 1 array)
Dataframe
(1 Index/M +
1 (dict + n array))
Panel
(1 Index/M +
n Dataframe)
built-in
numpy pandas
Struttura dati: DataFrame
2015
2016
2017
2018
2019
…...
2025
2026
2027
2028
Index
LAB1 LAB2 LAB3 LABn
. . . . . . . .
22
76
36
44
62
42
16
76
49
65
36
66
44
60
65
86
76
84
22
76
36
44
62
42
18
76
50
44
36
86
44
62
32
16
76
49
array
. .. .
YEAR
1
2
3
4
5
…...
30
31
32
33
Struttura dati: DataFrame
2015
2016
2017
2018
2019
…...
2025
2026
2027
2028
Index
LAB1 LAB2 LAB3 LABn
. . . . . . . .
22
76
36
44
62
42
16
76
49
65
36
66
44
60
65
86
76
84
22
76
36
44
62
42
18
76
50
44
36
86
44
62
32
16
76
49
array
LEZIONE 1..
www.fordatascientist.org
E00-PyData
E04-Pandas-DataStructures.ipynb
CONTATTI TELEFONO
051 22 35 20
EMAIL
WORKSHOP@VICEM.IT

More Related Content

PDF
Strutture dati 05-numpypandas
PDF
Data mining 05-numpypandas
PPTX
Análisis sitios web
PDF
Pastoral coletiva de 1890
PPTX
Comunidad Valenciana
PPT
Presentación de Moodle
PPTX
Importancia de la maquetación
PDF
Logfra17
Strutture dati 05-numpypandas
Data mining 05-numpypandas
Análisis sitios web
Pastoral coletiva de 1890
Comunidad Valenciana
Presentación de Moodle
Importancia de la maquetación
Logfra17

Viewers also liked (9)

PDF
Psicologia Laboral
PDF
Episcopado e profecia: Las Casas, Proaño e Romero.
PDF
Estudio de-mercado-cj-para-frutas-frescas
DOCX
El almohadón de plumas11
DOCX
El cambio
PDF
WhiteLotusCorpPresentation
PDF
Suryakant gupta
Psicologia Laboral
Episcopado e profecia: Las Casas, Proaño e Romero.
Estudio de-mercado-cj-para-frutas-frescas
El almohadón de plumas11
El cambio
WhiteLotusCorpPresentation
Suryakant gupta
Ad

Similar to Python advanced 01-numpypandas (18)

PDF
Strutture dati 05-numpypandas
PDF
Strutture dati 07-multiindex
PDF
Web advanced-03-d3 js-base
PDF
Python advanced 03-multiindex
ODP
primi comandi SQL con Mysql
PDF
corso web - Introduzione ai Database
ODP
SQL Unità 1 linguaggio DDL; DML, funzioni di aggregazione
PPTX
IBM i db2 udb vs Microsoft SQL Server
PPT
Basi Di Dati 03
PDF
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
PPT
R Vectors
PDF
scipy e rpy per l'analisi degli acquisti della pubblica amministrazione
PPSX
PDF
Data mining 06-dataframe
PPT
SQL Server2000
PDF
Strutture dati 07-multiindex
PDF
Strutture dati 06-dataframe
PDF
Web advanced-11-d3 js
Strutture dati 05-numpypandas
Strutture dati 07-multiindex
Web advanced-03-d3 js-base
Python advanced 03-multiindex
primi comandi SQL con Mysql
corso web - Introduzione ai Database
SQL Unità 1 linguaggio DDL; DML, funzioni di aggregazione
IBM i db2 udb vs Microsoft SQL Server
Basi Di Dati 03
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
R Vectors
scipy e rpy per l'analisi degli acquisti della pubblica amministrazione
Data mining 06-dataframe
SQL Server2000
Strutture dati 07-multiindex
Strutture dati 06-dataframe
Web advanced-11-d3 js
Ad

More from Studiabo (20)

PDF
Big data rischi
PDF
Big data correlazioni
PDF
Ravenna2019 - lezione Big Data
PDF
Strutture dati 08-reshape
PDF
Strutture dati 04-funzionicustom-classioggetti
PDF
Strutture dati 03-stutturedatibuiltin
PDF
Strutture dati 02-strutturecontrollo-funzionibuiltin
PDF
Strutture dati 01-numeristringhe
PDF
Strutture dati 00-corso2018-2019
PDF
Pres ulisse acciaio-ottobre2018
PDF
Strutture dati 08-reshape
PDF
Pres ulisse acciaio-aprile2018
PDF
Strutture dati 02-strutturecontrollo-funzionibuiltin
PDF
Strutture dati 06-dataframe
PDF
Strutture dati 04-funzionicustom-classioggetti
PDF
Strutture dati 03-stutturedatibuiltin
PDF
Strutture dati 01-numeristringhe
PDF
Strutture dati 00-corso2018
PDF
Data mining 00-corso2017
PDF
Data mining 04-funzionicustom-classioggetti
Big data rischi
Big data correlazioni
Ravenna2019 - lezione Big Data
Strutture dati 08-reshape
Strutture dati 04-funzionicustom-classioggetti
Strutture dati 03-stutturedatibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 01-numeristringhe
Strutture dati 00-corso2018-2019
Pres ulisse acciaio-ottobre2018
Strutture dati 08-reshape
Pres ulisse acciaio-aprile2018
Strutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 06-dataframe
Strutture dati 04-funzionicustom-classioggetti
Strutture dati 03-stutturedatibuiltin
Strutture dati 01-numeristringhe
Strutture dati 00-corso2018
Data mining 00-corso2017
Data mining 04-funzionicustom-classioggetti

Python advanced 01-numpypandas

  • 1. Corso Data Journalist gen-mar 2017 PYTHON ADVANCED Dalle liste ai dataframe
  • 2. Built -in Mappa sinottica: Strutture dati Classe Costruttore list [ ] dict { } Modulo numpy Classe Costruttore ndarray array ndarray matrixlib. defmatrix. matrix matrix Modulo pandas Classe Costruttore Index Index Multindex Multindex Series Series DataFrame DataFrame Panel4D Panel4D Panel Panel
  • 3. list Confronto tra list, array, Index - NO array + somma Index somma+ concatena - sottraz. + Stringhe Numeri unione * concatena * moltiplica sottraz.- Stringhe Numeri esclus. moltiplica* Numeri divide/ Numeri/ divide/ NO
  • 4. list Confronto tra list, array, Index array numpy.append( A1, A2) Index .append() (in-place) .append(..) (out-of-place) .sort() (in-place) numpy.sort( A1) .sort (in-place) .remove(..) (in-place) numpy.delete(A1, ..) .delete(...) (out-of-place) = (nuova var; stesso obj.) (nuova var; stesso obj.)= = (nuovo oggetto) Metodi per l’analisi statistica (ad esempio, mean()) Metodi per l’analisi statistica (ad esempio, mean()) Metodi per raggruppamenti e per trasformazioni
  • 6. Series e Dataframe Series Una Series è una classe pandas che può essere vista come un dizionario, in cui la chiave è data dall’indice della serie { 1: 100, 2: 120, 3: 132, 4: 131, 5 127 } Una volta istanziato esiste una relazione fissa tra indice (chiave) e valore. Diversamente da quanto avviene per una lista (array, Index), se si estrae una slice non viene modificata la relazione tra indice e valore DataFrame Un DataFrame è una classe pandas che può essere vista come un dizionario di Liste/Series, in cui la chiave identifica una Lista/Series. { ‘V1’: [ 100, 120, 132, 131, 127], ‘V2’: [ 132, 176, 232, 243, 457] } Ogni colonna di una DataFrame è identificata da una variabile. La lista di queste variabili forma l’attributo .columns Ogni riga di un DataFrame è identificata da un indice, assegnato all’attributo index. Questo indice è un oggetto della classe Index del modulo pandas.
  • 7. Liste [ , , , ] Dizionari { : , : , } Tuple ( , , , ) Set { , , , } Mappa sinottica Strutture Dati array e ndarray (statistica) matrix (matrici) Index (array+set) MultiIndex (Index+tuple) Series (1 Index/M. + 1 array) Dataframe (1 Index/M + 1 (dict + n array)) Panel (1 Index/M + n Dataframe) built-in numpy pandas
  • 8. Struttura dati: DataFrame 2015 2016 2017 2018 2019 …... 2025 2026 2027 2028 Index LAB1 LAB2 LAB3 LABn . . . . . . . . 22 76 36 44 62 42 16 76 49 65 36 66 44 60 65 86 76 84 22 76 36 44 62 42 18 76 50 44 36 86 44 62 32 16 76 49 array . .. . YEAR 1 2 3 4 5 …... 30 31 32 33
  • 9. Struttura dati: DataFrame 2015 2016 2017 2018 2019 …... 2025 2026 2027 2028 Index LAB1 LAB2 LAB3 LABn . . . . . . . . 22 76 36 44 62 42 16 76 49 65 36 66 44 60 65 86 76 84 22 76 36 44 62 42 18 76 50 44 36 86 44 62 32 16 76 49 array
  • 11. CONTATTI TELEFONO 051 22 35 20 EMAIL WORKSHOP@VICEM.IT