In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
Titanic disaster
Analysis of the categorical results.
We ought to find which passengers have chance to survive according to their affiliation to the established groups.
Source of data: https://www.kaggle.com/shivamp629/traincsv
In [2]:
df = pd.read_csv('c:/1/kaggletrain.csv')
df.head()
Out[2]:
In [3]:
Woj = ['#b6d7a8','#6aa84f']
# Plot
g = sns.catplot("Survived", col="Pclass", col_wrap=4,
data=df[df.Pclass.notnull()],
kind="count", height=3.5, aspect=.8,
palette=Woj)
plt.show()
Banking marketing
Analysis of the categorical results.
Source of data: https://archive.ics.uci.edu/ml/machine-learning-databases/00222/
In [4]:
df2 = pd.read_csv('c:/1/bank.csv')
df2.head(3)
Out[4]:
In [5]:
Kot = ['grey', 'red']
plt.figure(dpi= 380)
# Plot
g = sns.catplot("y", col="marital", col_wrap=4,
data=df2[df2.marital.notnull()],
kind="count", height=3.5, aspect=.8,
palette=Kot, alpha=0.5, legend=True)
plt.rc("font", size=15)
plt.show()
Clinical tests
Source of data: https://www.kaggle.com/saurabh00007/diabetescsv
In [6]:
df3 = pd.read_csv('c:/1/diabetes.csv')
df3.head(3)
Out[6]:
In [10]:
kot = ['young patient', 'medium patient', 'senior patient']
df3['Age group'] = pd.qcut(df['Age'],3, labels=kot)
In [11]:
Kot = ['#ff9900', '#783f04']
plt.figure(dpi= 380)
# Plot
g = sns.catplot("Outcome", col='Age group', col_wrap=4,
data=df3[df2.marital.notnull()],
kind="count", height=5.5, aspect=.7,
palette=Kot, alpha=0.4)
plt.rc("font", size=14)
plt.show()