Title: Using Seaborn To Visualize A Pandas Dataframe
Slug: pandas_with_seaborn
Summary: Using Seaborn To Visualize A Pandas Dataframe
Date: 2016-05-01 12:00
Category: Python
Tags: Data Wrangling
Authors: Chris Albon
In [2]:
import pandas as pd
%matplotlib inline
import random
import matplotlib.pyplot as plt
import seaborn as sns
In [3]:
df = pd.DataFrame()
df['x'] = random.sample(range(1, 100), 25)
df['y'] = random.sample(range(1, 100), 25)
In [4]:
df.head()
Out[4]:
In [5]:
sns.lmplot('x', 'y', data=df, fit_reg=False)
Out[5]:
In [6]:
sns.kdeplot(df.y)
Out[6]:
In [7]:
sns.kdeplot(df.y, df.x)
Out[7]:
In [8]:
sns.distplot(df.x)
Out[8]:
In [9]:
plt.hist(df.x, alpha=.3)
sns.rugplot(df.x);
In [10]:
sns.boxplot([df.y, df.x])
Out[10]:
In [11]:
sns.violinplot([df.y, df.x])
Out[11]:
In [12]:
sns.heatmap([df.y, df.x], annot=True, fmt="d")
Out[12]:
In [13]:
sns.clustermap(df)
Out[13]: