text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

import plotly.express as px

train_df = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
test_df = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv')
submission = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/submission.csv')

train_df.isna().sum()

test_df.isna().sum()

all_data = pd.concat([train_df, test_df], axis=0, sort=False)
all_data['Province_State'].fillna('None', inplace=True)
all_data['ConfirmedCases'].fillna(0, inplace=True)
all_data['Fatalities'].fillna(0, inplace=True)
all_data['Id'].fillna(-1, inplace=True)
all_data['ForecastId'].fillna(-1, inplace=True)

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
all_data['Date'] = pd.to_datetime(all_data['Date'])
all_data['Day_num'] = le.fit_transform(all_data.Date)
all_data['Day'] = all_data['Date'].dt.day
all_data['Month'] = all_data['Date'].dt.month
all_data['Year'] = all_data['Date'].dt.year

train = all_data[all_data['ForecastId'] == -1.0]
test = all_data[all_data['ForecastId'] != -1.0]

temp = train.groupby('Date')['ConfirmedCases', 'Fatalities'].sum().reset_index()
temp = temp.melt(id_vars='Date', value_vars=['ConfirmedCases', 'Fatalities'], var_name='case', value_name='count')
fig = px.line(temp, x='Date', y='count', color='case', title='Total cases over the Date ', color_discrete_sequence=['cyan', 'red'])
fig.show()