text_plain_output_1.png
import datetime

import pandas as pd

train = pd.read_csv('../input/train.csv')

train_sample = train.sample(frac=0.05)

import datetime
train_sample['date'] = train_sample['date'].apply(datetime.datetime.strptime, args=('%Y-%m-%d',))
train_sample.sort_values(by='date', inplace=True)

train_sample['onpromotion'].fillna(value='missing', inplace=True)
print(train_sample['onpromotion'].value_counts())