Python Data Processing with Pandas -...

Post on 08-Sep-2019

7 views 0 download

Transcript of Python Data Processing with Pandas -...

PythonDataProcessingwithPandas

CSE5542Introduc:ontoDataVisualiza:on

Pandas

•  AverypowerfulpackageofPythonformanipula:ngtables

•  Builtontopofnumpy,soisefficient

•  Saveyoualotofeffortfromwri:nglowerpythoncodeformanipula:ng,extrac:ng,andderivingtablesrelatedinforma:on

•  Easyvisualiza:onwithMatplotlib

•  Maindatastructures–SeriesandDataFrame

•  Firstthingfirst

•  Series:anindexed1Darray

•  Explicitindex

•  Accessdata

•  Canworkasadic:onary

•  Accessandslicedata

DataFrameObject

•  Generalizedtwodimensionalarraywithflexiblerowandcolumnindices

DataFrameObject

•  Generalizedtwodimensionalarraywithflexiblerowandcolumnindices

DataFrameObject

•  FromPandasSeries

DataFrameObject

•  FromPandasSeries

DataFrameObject

•  Anotherexample

ViewingData

•  ViewthefirstorlastNrows

ViewingData

•  Displaytheindex,columns,anddata

ViewingData

•  Quicksta:s:cs(forcolumnsABCDinthiscase)

ViewingData

•  Sor:ng:sortbytheindex(i.e.,reordercolumnsorrows),notbythedatainthetable

column

ViewingData

•  Sor:ng:sortbythedatavalues

Selec:ngData

•  Selec:ngusingalabel

Selec:ngData

•  Mul:-axis,bylabel

Selec:ngData

•  Mul:-axis,bylabelSlicing:lastincluded

Selec:ngData

•  Selectbyposi:on

Selec:ngData

•  Booleanindexing

Selec:ngData

•  Booleanindexing

SeZngData

•  SeZnganewcolumnalignedbyindexes

SeZngData

Opera:ons

•  Descrip:vesta:s:cs– Acrossaxis0(rows),i.e.,columnmean

– Acrossaxis1(column),i.e.,rowmean

Opera:ons

•  Apply

•  Histogram

MergeTables

•  Join

MergeTables

•  Append

Grouping

FileI/O

•  CSV

FileI/O

•  Excel