Source of data: https://github.com/selva86/datasets/blob/master/mpg_ggplot2.csv GSuite Text and Background Palette: https://yagisanatode.com/2019/08/06/google-apps-script-hexadecimal-color-codes-for-google-docs-sheets-and-slides-standart-palette/ 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 Source of data: https://github.com/fivethirtyeight/data/blob/master/alcohol-consumption/drinks.csv Source of data: https://data.world/promptcloud/world-happiness-report-2019 Analysis of the categorical results.import joypy
import pandas as pd
import matplotlib.pyplot as plt
Car market analysis
df= pd.read_csv('c:/1/mpg_ggplot2.txt')
df.head()
plt.figure(dpi= 380)
fig, axes = joypy.joyplot(df, column=['hwy', 'cty'], by="class", ylim='own', figsize=(12,8), legend=True, color=['#76a5af', '#134f5c'], alpha=0.9)
# Decoration
plt.title('Joy Plot of City and Highway Mileage by Class', fontsize=32, color='#d0e0e3', alpha=0.9)
plt.rc("font", size=20)
plt.xlabel('Year 2018', fontsize=16, color='darkred', alpha=1)
plt.ylabel('Data Scientist', fontsize=26, color='grey', alpha=0.8)
plt.show
color=['#76a5af', '#134f5c']
color=['#e06666', '#434343']
color=['#b6d7a8','#6aa84f']
Titanic disaster
df2 = pd.read_csv('c:/1/kaggletrain.csv')
df2.head(3)
df2['Age'].head()
AA = df2.pivot_table(index=['Name','Pclass'], columns='Sex', values='Age').reset_index()
AA.head()
plt.figure(dpi= 380)
fig, axes = joypy.joyplot(AA, column=['female', 'male'], by="Pclass", ylim='own', figsize=(12,8), legend=True, color=['#f4cccc', '#0c343d'], alpha=0.4)
# Decoration
plt.title('Titanic disaster: age distribution of casualties by the class', fontsize=32, color='#d0e0e3', alpha=0.9)
plt.rc("font", size=20)
plt.xlabel('Age of passengers', fontsize=16, color='darkred', alpha=1)
#plt.ylabel('Data Scientist', fontsize=26, color='grey', alpha=0.8)
plt.show
BB = df2.pivot_table(index=['Name','Survived'], columns='Sex', values='Age').reset_index()
BB.head()
plt.figure(dpi= 380)
fig, axes = joypy.joyplot(BB, column=['female', 'male'], by="Survived", ylim='own', figsize=(12,8), legend=True, color=['#a4c2f4', '#1c4587'], alpha=0.4)
# Decoration
plt.title('Titanic disaster: age distribution of casualties by the gender', fontsize=32, color='#d0e0e3', alpha=0.9)
plt.rc("font", size=20)
plt.xlabel('Age of passangers', fontsize=16, color='darkred', alpha=1)
plt.ylabel('Data Scientist', fontsize=26, color='grey', alpha=0.8)
plt.show
Drinks by Country
df3= pd.read_csv('c:/1/drinksbycountry.csv')
df3.head()
plt.figure(dpi= 380)
fig, axes = joypy.joyplot(df3, column=['beer_servings', 'spirit_servings','wine_servings'], by="continent", ylim='own', figsize=(12,8), legend=True, color=['#274e13', 'red', '#f1c232'], alpha=0.4)
# Decoration
plt.title('Alcohol consumption by continents', fontsize=32, color='#d0e0e3', alpha=0.9)
plt.rc("font", size=20)
plt.xlabel('The level of consumption', fontsize=16, color='darkred', alpha=0.4)
#plt.ylabel('Data Scientist', fontsize=26, color='grey', alpha=0.8)
plt.show
World Happiness Report
df4 = pd.read_csv('c:/1/WorldHappinessReport.csv')
df4.head(3)
df4['Year'].value_counts()
CC = df4[df4['Year']==2017]
CC.head(3)
plt.figure(dpi= 380)
fig, axes = joypy.joyplot(CC, column=['Freedom', 'Trust (Government Corruption)'], by="Region", ylim='own', figsize=(12,8), legend=True, alpha=0.4)
# Decoration
plt.title('World Happiness Report', fontsize=32, color='#d0e0e3', alpha=0.9)
plt.rc("font", size=20)
plt.xlabel('Indicator', fontsize=16, color='darkred', alpha=0.4)
plt.ylabel('Data Scientist', fontsize=26, color='grey', alpha=0.8)
plt.show
Banking marketing
Source of data: https://archive.ics.uci.edu/ml/machine-learning-databases/00222/df5 = pd.read_csv('c:/1/bank.csv')
df5.head(3)
FF = df5.pivot_table(index=['Unnamed: 0','marital'], columns='y', values='age').reset_index()
FF.head()
plt.figure(dpi= 380)
fig, axes = joypy.joyplot(FF, column=[0,1], by="marital", ylim='own', figsize=(12,8), legend=True, color=['#351c75', '#b4a7d6'], alpha=0.4)
# Decoration
plt.title('Customer age structure', fontsize=32, color='#d0e0e3', alpha=0.9)
plt.rc("font", size=20)
plt.xlabel('customer age', fontsize=16, color='darkred', alpha=0.4)
plt.ylabel('Data Scientist', fontsize=26, color='grey', alpha=0.8)
plt.show
Perfect Plots: Joyplot Plot
In [1]:
In [2]:
Out[2]:
In [3]:
Out[3]:
In [4]:
Out[4]:
In [5]:
Out[5]:
In [6]:
Out[6]:
In [7]:
Out[7]:
In [8]:
Out[8]:
In [9]:
Out[9]:
In [10]:
Out[10]:
In [11]:
Out[11]:
In [12]:
Out[12]:
In [13]:
Out[13]:
In [14]:
Out[14]:
In [15]:
Out[15]:
In [16]:
Out[16]:
In [17]:
Out[17]:
In [20]:
Out[20]: