image_output_1.png
import pandas as pd

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['date'] = pd.to_datetime(train['date'])
test['date'] = pd.to_datetime(test['date'])
data = pd.concat([train, test], axis=0, ignore_index=True)
assert len(data.drop_duplicates(['country', 'store', 'product', 'date'])) == len(data)
assert len(data.drop_duplicates(['country', 'store', 'product'])) == len(data) // data['date'].nunique()

train.isna().sum(axis=0).rename('nans_per_column_train').rename_axis('column').reset_index().set_index('column').join(test.isna().sum(axis=0).rename('nans_per_column_test').rename_axis('column').reset_index().set_index('column'))