Skip to content

Instantly share code, notes, and snippets.

@rkdgusrn1212
Last active May 31, 2022 11:06
Show Gist options
  • Save rkdgusrn1212/ffefda40ee59933975113f25e79b00f8 to your computer and use it in GitHub Desktop.
Save rkdgusrn1212/ffefda40ee59933975113f25e79b00f8 to your computer and use it in GitHub Desktop.
Missing Values : 2) Imputation
import pandas as pd
from sklearn.impute import SimpleImputer
data = pd.DataFrame()
imputer = SimpleImputer()
imputed_data = pd.DataFrame(imputer.fit_transform(data)) #imputed 된 dataframe, column이름도 index로 치환됨...
imputed_data.columns = data.columns #바뀐 column이름들 다시 넣어주기
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment