fordatascientist - python advanced data

Post on 20-Jan-2017

65 Views

Category:

Data & Analytics

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

LEZIONE 1..PYTHON AVANZATOlibrerie

NUMPY e PANDAS

Riepilogo lezione precedente

LISTA

SeriesEstrattore

DIZIONARIO

DataFrame

Array

Ndarray

[ ]

( )tupla

{ }

defPARAMETRO

ARGOMENTO

datetime.datetime

pandas.Period

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

[.....]

numpy.array([..])

pandas.Index

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

numpy.matrix

LEZIONE 1..www.fordatascientist.org

E00-PyDataE02-Numpy

’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 } }

LEZIONE 1..www.fordatascientist.org

E00-PyDataE04-Pandas-DataStructures.ipynb

LEZIONE 1..www.fordatascientist.org

E00-PyDataE06-Pandas-DF-Methods.ipynb

concat

map

merge

groupby

apply

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)

LEZIONE 1..www.fordatascientist.org

E00-PyDataE72-ReadCSV-EuroExchangeRate

Index Multi Index

LEZIONE 1..www.fordatascientist.org

H00-PyData-AdvancedH10-Pandas-MultiIndex1.ipynb

LEZIONE 1..www.fordatascientist.org

H00-PyData-AdvancedH10-Pandas-MultiIndex2.ipynb

index MultiIndex

.isin()

.loc()

.set_index()

.reset_index()

.sortlevel()

pandas.IndexSlice().unstack()

.stack()

LEZIONE 1..www.fordatascientist.org

H00-PyData-AdvancedH50-Pandas-TimeSeries.ipynb

.shift()

.resample()

CONTATTI TELEFONO

051 22 35 20

EMAIL WORKSHOP@VICEM.IT

top related