text_plain_output_1.png image_output_1.png
import pandas as pd

pd.set_option('display.max_columns', 50)
pd.set_option('display.max_rows', 50)

train = pd.read_csv('/kaggle/input/marketing-dsg/train.csv')
test = pd.read_csv('/kaggle/input/marketing-dsg/test.csv')
train_prior_order = pd.read_csv('/kaggle/input/marketing-dsg/train_prior_order.csv')
test_prior_order = pd.read_csv('/kaggle/input/marketing-dsg/test_prior_order.csv')
products = pd.read_csv('/kaggle/input/marketing-dsg/products.csv')
departments = pd.read_csv('/kaggle/input/marketing-dsg/departments.csv')
sample_submission = pd.read_csv('/kaggle/input/marketing-dsg/sample_submission.csv')

prior_order = train_prior_order.append(test_prior_order)

prior_order.shape

prior_order = pd.merge(prior_order, products, on='product_id', how='left')
prior_order = pd.merge(prior_order, departments, on='department_id', how='left')

prior_order_unique = prior_order.drop_duplicates('order_id')

prior_order_unique['days_since_prior_order'].describe()