1. import
import pandas as pd
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
2. view
df = pd.read_csv('test.csv')
df.head()
1) single plot
sns.displot(df.age)
-- view x-y graph according to age and count.
sns.set()
sns.set_style("whitegrid")
sns.lmplot(x='age', y='count', data=df)
-- view boxplot
sns.set()
sns.set_style("ticks")
sns.set_context("paper") --talk
plt.figure(figsize=(8,6)) --adjust size
sns.set_palette("bright") --define palette
sns.boxplot(data=df)
-- view scatterplot
sns.stripplot(x='age', y='count', data=df)
-- view swarm plot
sns.swarmplt(x='age', y='count', data=df)
2) multi-dimensional plot
grid = sns.FacetGrid(df, col="sex", hue="count")
grid.map(plt.hist, "Age")
grid.add_legent()
grid = sns.PairGrid(test, vars=["height", "weight"], hue="age")
grid.map(plt.scatter);
grid.add_legent();
sns.pairplt(test, hue="age", size=2.5)
'데이터분석 > pandas' 카테고리의 다른 글
data cleaning (0) | 2019.11.06 |
---|---|
nump 사용 (0) | 2019.10.31 |
data crawling (0) | 2019.10.28 |
pandas 데이터 모델링 (0) | 2019.08.25 |
pandas 기초 (0) | 2017.08.07 |