Kaggle competition: Digit Recognizer
<SOS> metric: categorizationaccuracy Kaggle data source: digit-recognizer<filter>
mnist_test = pd.read_csv(".. /input/mnist-in-csv/mnist_test.csv")
 mnist_train = pd.read_csv(".. /input/mnist-in-csv/mnist_train.csv" )
complete_df[complete_df['Fare'].isnull() ]<feature_engineering>
sample_submission = pd.read_csv(".. /input/digit-recognizer/sample_submission.csv")
 test = pd.read_csv(".. /input/digit-recognizer/test.csv")
 train = pd.read_csv(".. /input/digit-recognizer/train.csv" )
complete_df['Fare'] = complete_df.groupby('Pclass')['Fare'].transform(lambda val: val.fillna(val.median()))<feature_engineering>
test['dataset'] = 'test'
complete_df.loc[complete_df['Sex']=='female','Age'] = complete_df[complete_df['Sex']=='female']['Age'].transform(lambda val: val.fillna(val.median()))
complete_df.loc[complete_df['Sex']=='male', 'Age'] = complete_df[ complete_df['Sex']=='male' ]['Age'].transform(lambda val: val.fillna(val.median()))<count_missing_values>
train['dataset'] = 'train'
complete_df.isnull().sum()<drop_column>
dataset = pd.concat([train.drop('label', axis=1), test] ).reset_index()
X = complete_df[:891].drop(['PassengerId', 'Survived', 'Name', 'Ticket', 'Cabin'] ,axis=1)
 X<categorify>
mnist = pd.concat([mnist_train, mnist_test] ).reset_index(drop=True)
 labels = mnist['label'].values
mnist.drop('label', axis=1, inplace=True)
 mnist.columns = cols
X = pd.get_dummies(X)
 X<prepare_x_and_y>
idx_mnist = mnist.sort_values(by=list(mnist.columns)).index
dataset_from = dataset.sort_values(by=list(mnist.columns)) ['dataset'].values
original_idx = dataset.sort_values(by=list(mnist.columns)) ['index'].values
y = complete_df[:891]['Survived']<import_modules>
for i in range(len(idx_mnist)) :
if dataset_from[i] == 'test':
sample_submission.loc[original_idx[i], 'Label'] = labels[idx_mnist[i]]
from sklearn.model_selection import train_test_split<import_modules>
sample_submission.to_csv('submission.csv', index=False )