Kaggle competition: Rossmann Store Sales
<sort_values><EOS> 
import pandas as pd
import numpy as np
<SOS> metric: RootMeanSquarePercentageError Kaggle data source: rossmann-store-sales<sort_values>
import pandas as pd
import numpy as np
credit_card_balance.isnull().mean().sort_values(ascending = False )<sort_values>
data = pd.read_csv('.. /input/train.csv', sep=',', low_memory=False)
 data['StateHoliday'] = data['StateHoliday'].apply(lambda x: str(x))
bureau.isnull().mean().sort_values(ascending = False )<categorify>
grouppedByStoreDayPromo = data[data['Sales'] > 0].groupby(by=['Store', 'DayOfWeek', 'Promo'] )
for c in application_train.columns:
if(c!='SK_ID_CURR')&(application_train[c].dtypes==object):
LE = LabelEncoder()
LE.fit(list(application_train[c].values.astype('str')) + list(application_test[c].values.astype('str')))
 application_train[c] = LE.transform(list(application_train[c].values.astype('str')))
 application_test[c] = LE.transform(list(application_test[c].values.astype('str')))
 application_train.head()<correct_missing_values>
test = pd.read_csv('.. /input/test.csv', sep=',' )
application_train.fillna(-1, inplace = True )<train_model>
mn = data[data['Sales'] > 0].groupby(['Store', 'DayOfWeek', 'Promo'])['Sales'].mean().reset_index()
X = application_train.drop(['SK_ID_CURR', 'TARGET'],axis=1)
 Y = application_train.TARGET
xgb = XGBClassifier(n_estimators=500, max_depth=8, random_state=2018)
 xgb.fit(X, Y )<feature_engineering>
res = pd.merge(left=test, right=mn, on=['Store', 'DayOfWeek', 'Promo'], how='left')
 res.ix[res['Open'] == 0, 'Sales'] = 0
<merge><EOS> 
res[['Id', 'Sales']].to_csv('result_mean.csv', sep=',', index=None )