Back to DrivenData | Blog

Mean baseline with 4 lines in Python (loss=1.1273)

import pandas as pd
sb = pd.read_csv(‘submission_format.csv’, index_col=‘id’)
sb.loc[:,0:5] = pd.read_csv(‘train_labels.csv’).groupby([‘verified’]).mean()[-1:].values
sb.to_csv(‘mean_baseline.csv’)