<jupyter_start><jupyter_text>Create submission<jupyter_code>my_submission = test.copy()
my_submission = my_submission.merge(preds)
my_submission['ConfirmedCases'] = my_submission['PC']
my_submission['Fatalities'] = my_submission['PF']
my_submission.shape
my_submission.head()
my_submission[['ForecastId', 'ConfirmedCases', 'Fatalities']].to_csv('submission.csv', index=False)
my_submission.groupby('Date')[['ConfirmedCases', 'Fatalities']].sum().reset_index().tail()
end = dt.datetime.now()
print('Finished', end, (end - start).seconds, 's')
my_submission['target']=my_submission['Fatalities'].fillna(0)
my_submission.sort_values(by='Territory X Date',inplace=True)
my_submission[['Territory X Date','target']].to_csv("submission_beluga.csv",index=False)
my_submission[['Territory X Date','target']].tail()
my_submission[['Territory X Date','target']].head()<jupyter_output><empty_output><jupyter_text>Zindi Format<jupyter_code>best=pd.read_csv("submission_beluga.csv")
test=pd.read_csv("../input/covid19globalforecastingweek4/test.csv")
best=best.merge(test,how="left",on="ForecastId")
best.head()
# best=pd.read_csv("submission_beluga.csv")
# print(best.shape)
# best.head()
sub=pd.read_csv("../input/predicttheglobalspreadofcovid19/SampleSubmission.csv")
print(sub.shape)
sub.head()
new=sub['Territory X Date'].str.split(" X ", n = 1, expand = True) 
sub["Country_Region"]=new[0]
sub["Date"]=new[1]
sub['Date'] = pd.to_datetime(sub['Date'], format='%m/%d/%y')
sub['Date']= sub['Date'].astype(str)
sub.head()

best2=best.groupby(['Country_Region','Date'])['Fatalities'].sum().reset_index()
best2.loc[best2['Country_Region']=="US",'Country_Region']="United States of America (the)"
best2.loc[best2['Country_Region']=="Russia",'Country_Region']="Russian Federation (the)"
best2.loc[best2['Country_Region']=="United Kingdom",'Country_Region']="United Kingdom of Great Britain and Northern Ireland (the)"
best2.loc[best2['Country_Region']=="Iran",'Country_Region']="Iran (Islamic Republic of)"
best2.loc[best2['Country_Region']=="Venezuela",'Country_Region']="Venezuela (Bolivarian Republic of)"
best2.loc[best2['Country_Region']=="United Arab Emirates",'Country_Region']="United Arab Emirates (the)"
best2.loc[best2['Country_Region']=="Gambia",'Country_Region']="Gambia (the)"
best2.loc[best2['Country_Region']=="Netherlands",'Country_Region']="Netherlands (the)"
best2.loc[best2['Country_Region']=="Niger",'Country_Region']="Niger (the)"
best2.loc[best2['Country_Region']=="Tanzania",'Country_Region']="United Republic of Tanzania (the)"
best2.loc[best2['Country_Region']=="Vietnam",'Country_Region']="Viet Nam"
best2.loc[best2['Country_Region']=="Bahamas",'Country_Region']="Bahamas (the)"
best2.loc[best2['Country_Region']=="Bolivia",'Country_Region']="Bolivia (Plurinational State of)"
best2.loc[best2['Country_Region']=="Central African Republic",'Country_Region']="Central African Republic (the)"
best2.loc[best2['Country_Region']=="Congo",'Country_Region']="Congo (the)"
best2.loc[best2['Country_Region']=="Comoros",'Country_Region']="Comoros (the)"
best2.loc[best2['Country_Region']=="Korea, South",'Country_Region']="Republic of Korea (the)"
best2.loc[best2['Country_Region']=="Democratic Republic of the Congo",'Country_Region']="Democratic Republic of the Congo (the)"
best2.loc[best2['Country_Region']=="Dominican Republic",'Country_Region']="Dominican Republic (the)"
best2.loc[best2['Country_Region']=="Moldova",'Country_Region']="Republic of Moldova (the)"
best2.loc[best2['Country_Region']=="Sudan",'Country_Region']="Sudan (the)"
best2.loc[best2['Country_Region']=="Syria",'Country_Region']="Syrian Arab Republic (the)"

sub=sub.merge(best2,how="left",on=['Country_Region','Date'])
sub['target']=sub['Fatalities'].fillna(0)
sub[['Territory X Date','target']].to_csv("ma20200417_beluga.csv",index=False)
sub[['Territory X Date','target']].head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20539845758354755, 'fraction_numerical': 0.016452442159383032, 'mean_word_length': 14.023166023166024, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '401879', 'license': 'MIT', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1375, 'n_words': 162, 'path': 'AI4D Predict the Global Spread of COVID-19/Solution 3/Zindi - predict-the-global-spread-of-covid-BELUGA.ipynb', 'repo_name': 'ZindiAfrica/Time-Series-Forecasting', 'size': '3890'}