text_plain_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

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

import seaborn as sns

grid_df = pd.read_pickle('/kaggle/input/m5-simple-fe/grid_part_1.pkl')

grid_df = grid_df[['id', 'd', 'sales']].pivot(index='id', columns='d').reset_index()
ids = grid_df['id']

grid_df = grid_df['sales'].iloc[:, :1913]
grid_df = pd.DataFrame(np.where(grid_df.isnull(), np.nan, np.where(grid_df > 0, 1, -1)))
grid_df.columns = [f'd_{i}' for i in range(1, 1914)]

d1_peak = grid_df.notnull().sum(axis=1)
cluster = d1_peak.copy()

sns.kdeplot(d1_peak)
plt.title('# of Nan distribution')
plt.show()