text_plain_output_1.png
import numpy as np

import pandas as pd

import seaborn as sns

import seaborn as sns

train = pd.read_csv('../input/juniper-networks-global-ai-challenge/training_dataset.csv')
test = pd.read_csv('../input/juniper-networks-global-ai-challenge/test_dataset.csv')

train.register__sales_dollar_amt_this_hour.plot.density(color='red')

y_train = train['register__sales_dollar_amt_this_hour']
train = train.drop(['region__peak_sales_dollar_amt_per_hour_v2', 'region__peak_returns_dollar_amt_per_hour_v2', 'Unnamed: 0'], axis=1)
test = test.drop(['region__peak_sales_dollar_amt_per_hour_v2', 'region__peak_returns_dollar_amt_per_hour_v2'], axis=1)

train['observation_timestamp'] = pd.to_datetime(train['observation_timestamp'])
test['observation_timestamp'] = pd.to_datetime(test['observation_timestamp'])

pd.to_datetime(train['observation_timestamp']).dt.month

import datetime as dt
train['weekday'] = pd.to_datetime(train['observation_timestamp']).dt.weekday
train['weekend'] = np.where(train['weekday'] < 5, 0, 1)
test['weekday'] = pd.to_datetime(test['observation_timestamp']).dt.weekday
test['weekend'] = np.where(test['weekday'] < 5, 0, 1)
train['month'] = pd.to_datetime(train['observation_timestamp']).dt.month
test['month'] = pd.to_datetime(train['observation_timestamp']).dt.month
train = train.drop(['observation_id', 'observation_timestamp'], axis=1)
test = test.drop(['observation_id', 'observation_timestamp'], axis=1)

import seaborn as sns
def target_mean(data, feature, target, decimal=2):
    return data.groupby(feature).agg({target: 'mean'}).sort_values(by=[target], ascending=[False]).round(decimal)

import seaborn as sns
target_mean(train, 'hour_of_day', 'register__sales_dollar_amt_this_hour')