how to import seaborn
how to load data set titanic
how to import mtplot lib
In [6]:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
sns.set_style('whitegrid')
titanic = sns.load_dataset('titanic')
In [39]:
#titanic.head(7)
In [5]:
# watch 5 rows in data set
In [7]:
Out[7]:
In [40]:
sns.jointplot(x='fare',y='age',data=titanic)
Out[40]:
In [9]:
Out[9]:
In [41]:
sns.distplot(titanic['fare'])
Out[41]:
In [42]:
sns.distplot(titanic['fare'],kde=False)
Out[42]:
In [43]:
sns.distplot(titanic['fare'],kde=False,color="r")
Out[43]:
In [47]:
sns.distplot(titanic['fare'],kde=False,color="r",bins=130)
Out[47]:
In [16]:
Out[16]:
In [49]:
sns.boxplot(x='class',y='age',data=titanic)
Out[49]:
In [50]:
sns.boxplot(x='class',y='age',data=titanic,palette='rainbow')
Out[50]:
In [22]:
Out[22]:
In [51]:
sns.swarmplot(x='class',y='age',data=titanic)
Out[51]:
In [52]:
sns.swarmplot(x='class',y='age',data=titanic,palette='Set2')
Out[52]:
In [27]:
Out[27]:
In [53]:
sns.countplot(x='sex',data=titanic)
Out[53]:
In [29]:
Out[29]:
In [55]:
titanic.corr()
#sns.heatmap(titanic.corr(),cmap='coolwarm')
Out[55]:
In [56]:
sns.heatmap(titanic.corr(),cmap='coolwarm')
#plt.title('titanic.corr()')
Out[56]:
In [33]:
Out[33]:
In [57]:
g = sns.FacetGrid(data=titanic,col='sex')
#g.map(plt.hist,'age')
In [58]:
g = sns.FacetGrid(data=titanic,col='sex')
g.map(plt.hist,'age')
Out[58]:
No comments:
Post a Comment