Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python Visualization Tools: Pandas, Seaborn, ggplot

Similar presentations


Presentation on theme: "Python Visualization Tools: Pandas, Seaborn, ggplot"— Presentation transcript:

1 Python Visualization Tools: Pandas, Seaborn, ggplot
郝蕊

2 Pandas the fundamental high-level building block for doing practical, real world data analysis in Python get data from csv, excel, hdf, sql, json, html, stata basic plot function, may need to learn matplotlib to customize pandas + other visualization library

3 Pandas - Data Structures
Series one-dimensional labeled array s = Series(data, index=index) python dict ndarray scalar value ndarray-like dict-like vectorized operation Series(randn(5), index=['a', 'b', 'c', 'd', 'e']) a b c d e d = {'a' : 0., 'b' : 1., 'c' : 2.} Series(d, index=['b', 'c', 'd', 'a']) b 1 c 2 d NaN a 0

4 Pandas – Data Structures
DataFrame 2-dimensional labeled columns, index df = DataFrame(data, index=index) dict of series or dicts dict of ndarrays / lists list of dicts d = {'one' : Series([1., 2.], index=['a', 'b']), 'two' : Series([1., 2., 3.], index=['a', 'b', 'c'])} DataFrame(d, index=[‘c', 'a'], columns=['two', 'three']) two three c NaN a NaN d = {'one' : [1., 2., 3., 4.], 'two' : [4., 3., 2., 1.]} DataFrame(d, index=['a', 'b', 'c', 'd']) one two a b c d

5 Pandas – Data Structures
Panel 3-dimensional data wp = Panel(data, items,major_axis,minor_axis) 3D ndarray dict of dataframe wp = Panel(randn(2, 5, 4), items=['Item1','Item2'], major_axis=date_range('1/1/2000', periods=5), minor_axis=['A', 'B', 'C', 'D']) A B C D

6 Seaborn Python visualization library based on matplotlib
making more complicated plots simpler to create, does not do much for simple chart built in styles to quickly change the color theme support for numpy, pandas data structures support for scipy, statsmodels statictical routines

7 Seaborn – Plot Gallery

8 Seaborn – Plot Types Linear model plots quantitative data
categorical data regression: simple or multiple faceted linear model nonlinear, logistic regression outliers marginal distributions examining model residuals pairwise relationship Residuals: 残差

9 Seaborn – Plot Types Matrix plots Timeseries plots Miscellaneous plots
cluster map heat map Timeseries plots Miscellaneous plots

10 Seaborn - Example

11 ggplot improve the visual appeal of matplotlib visualizations in a simple way port of ggplot2 of R, some API is non-pythonic but very powerful support pandas

12 ggplot – Plot Gallery bar density facetgrid histogram line scatter
smooth

13 ggplot - Example


Download ppt "Python Visualization Tools: Pandas, Seaborn, ggplot"

Similar presentations


Ads by Google