Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

simple imputer python

from sklearn.impute import SimpleImputer

imputer = SimpleImputer(strategy='median')

# for the entire df
df = pd.DataFrame(imputer.fit_transform(df), columns=df.columns)

# for specific column
df['Embarked'] = pd.DataFrame(imputer.fit_transform(pd.DataFrame(df['Embarked'], columns=['Embarked'])), columns=['Embarked'])
 
PREVIOUS NEXT
Tagged: #simple #imputer #python
ADD COMMENT
Topic
Name
7+6 =