2 way to transform from different types: .loc or mapping
When we have to tranform a column from type to type,here are two ways:
1
all_data.loc[all_data["edjefe"]=="yes","edjefe"]=1
2
mapping = {"yes": 1, "no": 0}
all_data['edjefe'] = all_data['edjefe'].replace(mapping).astype(np.float64)
# put it another way
all_data['edjefe'].replace({"yes": 1, "no": 0}).astype(np.float64)