text_plain_output_1.png
import pandas as pd

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

df_train = pd.read_csv('/kaggle/input/seoul-bike-rental-ai-pro-iti/train.csv')

df_test = pd.read_csv('/kaggle/input/seoul-bike-rental-ai-pro-iti/test.csv')
df_test

df_train.isna().sum()

df_test.isna().sum()

table = pd.crosstab(df_train['Holiday'], df_train['Functioning Day'])

y = df_train['y'].copy()
df_train.drop(['y'], axis='columns', inplace=True)
df_train['y'] = y

df_train.columns

df_test.columns

data_all = pd.concat((df_train, df_test), ignore_index=True)

data_all.isna().sum()

data_all.columns

Mean_encoded_Seasons = data_all.groupby('Seasons')['y'].mean().to_dict()
data_all['Seasons'] = data_all['Seasons'].map(Mean_encoded_Seasons)

Mean_encoded_dew = data_all.groupby('month')['y'].mean().to_dict()
data_all['month'] = data_all['month'].map(Mean_encoded_dew)

data_all['Holiday'].value_counts()