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]:
In [6]:
df_men = df[df["Gender"] == 'Male']
In [7]:
df_men.corr()
Out[7]:
In [19]:
df_men.plot(kind='scatter', x='Height', y='Weight', figsize=(10,5), alpha=0.5)
Out[19]:
In [8]:
df_women = df[df["Gender"] == 'Female']
In [9]:
df_women.corr()
Out[9]:
In [18]:
df_women.plot(kind='scatter', x='Height', y='Weight', figsize=(10,5), alpha = 0.5, c='r')
Out[18]:
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 [ ]: