In [11]:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
df = pd.read_csv('heights_weights_genders.csv')

In [4]:
df.head()


Out[4]:
Gender Height Weight
0 Male 73.847017 241.893563
1 Male 68.781904 162.310473
2 Male 74.110105 212.740856
3 Male 71.730978 220.042470
4 Male 69.881796 206.349801

In [6]:
df_men = df[df["Gender"] == 'Male']

In [7]:
df_men.corr()


Out[7]:
Height Weight
Height 1.000000 0.862979
Weight 0.862979 1.000000

In [19]:
df_men.plot(kind='scatter', x='Height', y='Weight', figsize=(10,5), alpha=0.5)


Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x10d3f2048>

In [8]:
df_women = df[df["Gender"] == 'Female']

In [9]:
df_women.corr()


Out[9]:
Height Weight
Height 1.000000 0.849609
Weight 0.849609 1.000000

In [18]:
df_women.plot(kind='scatter', x='Height', y='Weight', figsize=(10,5), alpha = 0.5, c='r')


Out[18]:
<matplotlib.axes._subplots.AxesSubplot at 0x10cf643c8>

In [24]:
# both in one graph

ax = df_women.plot(kind='scatter', x='Height', y='Weight', figsize=(10,5), c='r', alpha=0.5)
df_men.plot(ax = ax, kind='scatter', x='Height', y='Weight', alpha = 0.5)

ax.set_title("Weight correlates with height")
ax.set_xlabel('Height [in inches]')
ax.set_ylabel('Weight [in pounds]')

plt.savefig('Quick_sketch.png')



In [ ]: