Horje
normalize a group in countplot Code Example
normalize a group in countplot
import numpy as np
import pandas as pd
import seaborn as sns
sns.set(color_codes=True)

df = sns.load_dataset('titanic')
df.head()

x,y = 'class', 'survived'

(df
.groupby(x)[y]
.value_counts(normalize=True)
.mul(100)
.rename('percent')
.reset_index()
.pipe((sns.catplot,'data'), x=x,y='percent',hue=y,kind='bar'))






Python

Related
python how to automatically restart flask sever Code Example python how to automatically restart flask sever Code Example
type of tuple in python Code Example type of tuple in python Code Example
django media url Code Example django media url Code Example
modules in python Code Example modules in python Code Example
pandas split groupby Code Example pandas split groupby Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6