Write a function that takes in the three attributes of a Simpson character and outputs the gender classification.

Remember what we're splitting on

Test the function with the Comic's attributes

Submit your code and give feedback on the Do Now in your PR


In [9]:
import pandas as pd
%matplotlib inline
import math
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
import numpy as np

In [17]:
df = pd.read_excel("simpson-eg.xlsx")
df


Out[17]:
Person Hair Length Weight Age Class
0 Homer 0 250 36 M
1 Marge 10 150 34 F
2 Bart 2 90 10 M
3 Lisa 6 78 8 F
4 Maggie 4 20 1 F
5 Abe 1 170 70 M
6 Selma 8 160 41 F
7 Otto 10 180 38 M
8 Krusty 68 200 45 M
9 Comic 8 290 38 NaN

In [25]:
def simpson_classifier(hair, weight, age):
    if weight <= 160:
        return "Female"
    else: 
        return "Male"

In [26]:
simpson_classifier(8,290, 38)


Out[26]:
'Male'

In [ ]: