text_plain_output_1.png
import matplotlib.pyplot as plt

import os

import pandas as pd

import warnings

import math
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
import warnings
warnings.filterwarnings('ignore')
PUBLIC_PRIVATE = 1
import os

df_train = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
df_test = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv')
sub_example = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/submission.csv')
regr_ensemble_sub = pd.read_csv('/kaggle/input/regressors-ensemble-submission-week-4/submission (4).csv')

df_train['ForecastId'] = -1
df_train['DataType'] = 0
df_test['DataType'] = 2
df_test['ConfirmedCases'] = -1
df_test['Fatalities'] = -1
df_test['Id'] = df_test['ForecastId'] + df_train['Id'].max()
df_intersection = df_train[df_train['Date'] >= df_test['Date'].min()]
df_intersection['DataType'] = 1
df_intersection['ForecastId'] = df_test[df_test['Date'] <= df_train['Date'].max()]['ForecastId'].values
df_train = df_train[df_train['Date'] < df_test['Date'].min()]
df_test = df_test[df_test['Date'] > df_intersection['Date'].max()]
if not PUBLIC_PRIVATE:
    df_intersection['ConfirmedCases'] = -1
    df_intersection['Fatalities'] = -1
    df_full = pd.concat([df_train, df_intersection, df_test], sort=False, axis=0)
else:
    df_full = pd.concat([df_train, df_intersection, df_test], sort=False, axis=0)

df_full['Province_State'] = df_full['Province_State'].fillna('')
df_full['Location'] = ['_'.join(x) for x in zip(df_full['Country_Region'], df_full['Province_State'])]
df_full.drop(columns=['Province_State', 'Country_Region'], inplace=True)
df_full.shape