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)

holiday_events = pd.read_csv('../input/holidays_events.csv')
items = pd.read_csv('../input/items.csv')
oil = pd.read_csv('../input/oil.csv')
stores = pd.read_csv('../input/stores.csv')
test = pd.read_csv('../input/test.csv')
transactions = pd.read_csv('../input/transactions.csv')

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

daily_sale = pd.DataFrame()
daily_sale['count'] = train_sample['date'].value_counts()
daily_sale['date'] = train_sample['date'].value_counts().index
daily_sale = daily_sale.sort_values(by='date')
print(daily_sale.head(3))
unit_sale = pd.DataFrame()
unit_sale['count'] = train_sample[train['unit_sales'] > 0]['unit_sales'].value_counts()
unit_sale['positive_unit_sales'] = train_sample[train['unit_sales'] > 0]['unit_sales'].value_counts().index
unit_sale = unit_sale.sort_values(by='positive_unit_sales')