Форма крышки:
Код: Выделить всё
Bell Conical Flat
1 0 0
Код: Выделить всё
Cap Shape_Bell Cap Shape_Conical Cap Shape_Flat
1 0 0
Код: Выделить всё
mode = df['Stalk Root'].mode() #most common amswer is b
df = df.replace('?', 'b') #replace all question marks with most common value
df['Ring Number'] = df['Ring Number'].replace({'n': 0, 'o': 1, 't': 2}).astype(int)
df['Gill Spacing'] = df['Gill Spacing'].replace({'c': 0, 'w': 1, 'd': 2}).astype(int)
df = pd.get_dummies(df)
df.drop(labels = ['Poisonous_e', 'Bruises_f', 'Gill Size_n', 'Stalk Shape_t', 'Veil Type_p'], axis = 1, inplace = True)
df.rename(columns={'Poisonous_p': 'Poisonous', 'Bruises_t': 'Bruises'}, inplace = True)
Подробнее здесь: https://stackoverflow.com/questions/782 ... d-features