text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

submission = pd.read_csv('/kaggle/input/tabular-playground-series-sep-2022/sample_submission.csv')
train = pd.read_csv('/kaggle/input/tabular-playground-series-sep-2022/train.csv')
test = pd.read_csv('/kaggle/input/tabular-playground-series-sep-2022/test.csv')

train.groupby(train['day'])['num_sold'].mean().sort_values(ascending=False)

train.groupby(train['month'])['num_sold'].mean().sort_values(ascending=False)

train.groupby(train['year'])['num_sold'].mean().sort_values(ascending=False)

train.groupby(train['dayofweek'])['num_sold'].mean().sort_values(ascending=False)

train.isnull().sum()

for x in train[train['year'] == 2020]['month'].index:
    if train['month'].loc[x] == 1:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 6:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 7:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 8:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 9:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 10:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 11:
        train['Covid'].loc[x] = 0
    elif train['month'].loc[x] == 12:
        train['Covid'].loc[x] = 0
    else:
        train['Covid'].loc[x] = 1