# -*- coding: utf-8 -*-
"""
Created on Sun Jan  2 13:32:34 2022

@author: Sim
"""
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv(r'D:\HTEX\Pythonbk\codesdata\bmi.csv')

ftab = df['gender'].value_counts()
fdf = pd.DataFrame({'gender':ftab.index, 'freq':ftab.values})
fdf.plot.bar(x='gender', y='freq')
fdf.plot.pie(y='freq', label='gender')

mm = df.groupby('gender')['height'].mean()
mdf = mm.to_frame().reset_index()
mdf.plot.bar(x='gender', y='height')

fig, (ax1, ax2) = plt.subplots(1,2)
gdf = df.groupby('gender')
gdf.get_group('M').hist('height', edgecolor='white', ax=ax1)
gdf.get_group('F').hist('height', edgecolor='white', ax=ax2)

df.boxplot(column='height', by='gender')

