fordatascientist - python advanced data

17

Click here to load reader

Upload: annalisa-vignoli

Post on 20-Jan-2017

65 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: ForDataScientist - Python advanced data

LEZIONE 1..PYTHON AVANZATOlibrerie

NUMPY e PANDAS

Page 2: ForDataScientist - Python advanced data

Riepilogo lezione precedente

LISTA

SeriesEstrattore

DIZIONARIO

DataFrame

Array

Ndarray

[ ]

( )tupla

{ }

defPARAMETRO

ARGOMENTO

datetime.datetime

pandas.Period

Page 3: ForDataScientist - Python advanced data

OGGETTI APPARENTE-MENTE SIMILI POSSONO ESSERE IN REALTA’ MOLTO DIVERSI

[.....]

numpy.array([..])

pandas.Index

numpy.array([.[..].])

numpy.matrix

Page 4: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

E00-PyDataE02-Numpy

Page 5: ForDataScientist - Python advanced data

’201501’ 125.6 ‘201506’ 128.3 ‘201507’ 132.9 ‘201508’ 133.1 ‘201509’ 135.5 ‘201510’ 135.2 ‘201511’ 138.6

DataFrame Seriesindex values D1 D2

’201501’ 125.6 745 ‘201506’ 128.3 234 ‘201507’ 132.9 654 ‘201508’ 133.1 954 ‘201509’ 135.5 849 ‘201510’ 135.2 621 ‘201511’ 138.6 485

indexcolumns

values

{ ’201501’: 125.6, …… ‘201511’: 138.6 }

{ D1: {’201501’: 125.6, …… ‘201511’: 138.6 }, D2: {’201501’: 745, …… ‘201511’: 485 } }

Page 6: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

E00-PyDataE04-Pandas-DataStructures.ipynb

Page 7: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

E00-PyDataE06-Pandas-DF-Methods.ipynb

Page 8: ForDataScientist - Python advanced data

concat

map

merge

groupby

apply

Page 9: ForDataScientist - Python advanced data

input esterni

da memoria di massa o da memoria centrale

pandas.read_csv (indirizzo di memoria)pandas.read_pickle (indirizzo di memoria)…pandas.read_excel (indirizzo di memoria)

da memoria centrale da memoria di massa

indirizzo di memoria= path + nome file utilizzo della classe StringIO del modulo standard io, per leggere e scrivere memory file (stringhe formatatte come file)

Page 10: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

E00-PyDataE72-ReadCSV-EuroExchangeRate

Page 11: ForDataScientist - Python advanced data

Index Multi Index

Page 12: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

H00-PyData-AdvancedH10-Pandas-MultiIndex1.ipynb

Page 13: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

H00-PyData-AdvancedH10-Pandas-MultiIndex2.ipynb

Page 14: ForDataScientist - Python advanced data

index MultiIndex

.isin()

.loc()

.set_index()

.reset_index()

.sortlevel()

pandas.IndexSlice().unstack()

.stack()

Page 15: ForDataScientist - Python advanced data

LEZIONE 1..www.fordatascientist.org

H00-PyData-AdvancedH50-Pandas-TimeSeries.ipynb

Page 16: ForDataScientist - Python advanced data

.shift()

.resample()

Page 17: ForDataScientist - Python advanced data

CONTATTI TELEFONO

051 22 35 20

EMAIL [email protected]