Javascript is required
/machine-learning/bootcamp/07-pandas-data-visualization/07-pandas-data-visualization.md

Machine Learning Udemy Bootcamp 06 - Pandas data visualization

Pandas has some built-in data-visualization tool that allows to easily display dataframe plots based on the dataframe itself or one of its features.
It's possible to choose if draw plots using matplotlib, seaborn or pandas built-in.

Plotting with Pandas

A simple plot:

df1['A'].hist(bins=30)

It's possible to choose what kind of syntax to use:

# df columns expose plot method
df1['A'].plot(
    # what kind of plot
    kind='hist',
    bins=30
)
# shorthand
df1['A'].plot.hist(bins=30)
Pandas histplot 1

AREA PLOT

df2.plot.area(
    # transparency
    alpha=0.4
)
Pandas histplot 2

BAR PLOT

# considers categorical indexes, if number they will be treated as categories
df2.plot.bar()
Pandas barplot 1
# onlw shows the offset between bars
df2.plot.bar(stacked=True)
Pandas barplot 2

SCATTER PLOT

df1.plot.scatter(
    # feature A on x axis
    x='A',
    # feature B on y axis
    y='B',
    # color based on feature C, adds 3rd dimension
    c='C',
    # adjust size of dots based on feature C
    s=df1['C'] * 100,
    cmap='coolwarm'
)
Pandas scatteplot

BOX PLOT

df2.plot.box()
Pandas boxplot

HEXBIN PLOT

df = pd.DataFrame(np.random.randn(1000, 2), columns=['a', 'b'])
df.plot.hexbin(x='a', y='b', gridsize=25, cmap='coolwarm')
Pandas hexbinplot

KDE PLOT (Kernel Density Estimation)

df2['a'].plot.kde()
Pandas kdeplot

DENSITY PLOT

df2.plot.density()
Pandas density plot

Git

GO

GitGOmachine-learningpandasseaborngithubudemymatplotlibnplmdstorage