<jupyter_start><jupyter_text>emdat<jupyter_code># loading data 
table= pd.read_excel('emdat_public_2020_09_12_query_uid-tAnKEX.xlsx',skiprows=6)
# Selecting floods 
flood_table=table[table['Disaster Type']=='Flood']
flood_table
flood_table.columns
flood_table.info()
flood_table['Country']=flood_table['Country'].apply(lambda x: x.lower())
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (the)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (plurinational state of)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (the democratic republic of the)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("côte d’ivoire","ivory coast"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("bosnia and herzegovina","bosnia-herzegovina"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (islamic republic of)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (the republic of)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (the democratic people's republic of)",""))

flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (the former yugoslav republic of)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (province of china)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (bolivarian republic of)",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" (federated states of)",""))


flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" fed rep",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" p dem rep",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace(" arab rep",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("tanzania, united republic of","tanzania"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("palestine, state of","palestine"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("russian federation","russia"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("syrianublic","syria"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("lao people's democratic republic","laos"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("canary is","canary islands"))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("",""))
flood_table['Country']=flood_table['Country'].apply(lambda x: x.replace("viet nam","vietnams"))


print('number of countries :',len(flood_table['Country'].sort_values(ascending=True).unique()))
flood_table_countries= flood_table['Country'].sort_values(ascending=True).unique()
flood_table_countries
print('from',flood_table['Year'].min(),'to',flood_table['Year'].max())<jupyter_output>from 1900 to 2020<jupyter_text>Flood Archive<jupyter_code># loading data 
archive_flood_table= pd.read_excel('FloodArchive.xlsx')
archive_flood_table
### Coutries cleaning 
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x[1:] if x.find(' ')==0 else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("\xa0", ""))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Bangaldesh", "Bangladesh"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Bangledesh", "Bangladesh"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Boliva", "Bolivia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Bosnia-Herzegovenia", "Bosnia-Herzegovina"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Bosnia and Herzegovina", "Bosnia-Herzegovina"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Bosnia and Herzogovina", "Bosnia-Herzegovina"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Burkino Faso", "Burkina Faso"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Camaroun", "Cameroon"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Cameroun", "Cameroon"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Camaroon", "Cameroon"))

archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Cental African Republic", "Central African Republic"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("China ", "China"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Columbia", "Colombia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Comoros islands", "Comoros Islands"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Congo Republic", "Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Cote D'Iavoir", "Ivory Coast"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Cote d'Ivoire", "Ivory Coast"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("DR Congo", "Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Democratic  Republic of the Congo", "Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Democratic Republic Congo", "Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Democratic Republic of Congo", "Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Democratic Republic of the Congo", "Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Ecuador ", "Ecuador"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("El Savador", "El Salvador"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Guatamala","Guatemala"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Inda","India"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Indonesia ","Indonesia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Inonesia","Indonesia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Kazahkstan","Kazakhstan"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Madascar","Madagascar"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Malayasia","Malaysia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Malaysia ","Malaysia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Moldava","Moldova"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Moldovo","Moldova"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Myanamar","Myanmar"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Papua New Gunea","Papua New Guinea"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Philippine","Philippines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Philipines","Philippines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Phillipines","Philippines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Phillippines","Philippines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Philippiness","Philippines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Republic of Congo","Congo"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Philippiness","Philippines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Serbia and Montenegro","Serbia-Montenegro"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("South Korea ","South Korea"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Tajikstan","Tajikistan"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("The Gambia","Gambia"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("USA.","united states of america"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("USA","united states of america"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("USSR","Soviet Union"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Uruguay,","Uruguay"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Venezulea","Venezuela"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Vietnam","Viet Nam"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("Zimbawe","Zimbabwe"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.lower())
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("united arab emerates","united arab emirates"))

archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("west germany","germany"))

archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: 'united kingdom of great britain and northern ireland'if x=='uk' else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: 'united kingdom of great britain and northern ireland'if x=='unitd kingdom'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: 'united kingdom of great britain and northern ireland'if x=='united kingdom'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "united kingdom of great britain and northern ireland"if x=='england'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "united kingdom of great britain and northern ireland"if x=='britain'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "united kingdom of great britain and northern ireland"if x=='britain, ireland'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "united kingdom of great britain and northern ireland"if x=='northern ireland'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "united kingdom of great britain and northern ireland"if x=='scotland'else x)

archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "trinidad and tobago"if x=='tobago'else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "trinidad and tobago"if x=='trinidad'else x)


archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("texas","united states of america"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("thiland","thailand"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("gaza","palestine"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("east timor","timor"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("burma/myanmar","myanmar"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("burma","myanmar"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("timor","indonesia"))

archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("saint vincent","saint vincent and the grenadines"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("north korea","korea"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("south korea","korea"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("bermuda","bermudes"))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: "bosnia-herzegovina" if x=="bosnia" else x)
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("",""))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("",""))
archive_flood_table['Country']=archive_flood_table['Country'].apply(lambda x: x.replace("viet nam","vietnam"))

print('number of countries: ', len(archive_flood_table['Country'].unique()))
archive_flood_table_countries=archive_flood_table['Country'].sort_values(ascending=True).unique()
archive_flood_table_countries
# countries in emdat and not in floodarchive
for country in flood_table_countries:
    if not(country in archive_flood_table_countries):
        print (country)
# countries in floodarchive and not in emdat
for country in archive_flood_table_countries:
    if not(country in flood_table_countries):
        print (country)
# countries in commun
counter=0
for country in archive_flood_table_countries:
    if (country in flood_table_countries):
        print (country)
        counter+=1
print(counter)
archive_flood_table
archive_flood_table.info()
archive_flood_table['Start Day'] = archive_flood_table.Began.dt.day
archive_flood_table['Start Month'] = archive_flood_table.Began.dt.month
archive_flood_table['Start Year'] = archive_flood_table.Began.dt.year
archive_flood_table['End Day'] = archive_flood_table.Began.dt.day
archive_flood_table['End Month'] = archive_flood_table.Began.dt.month
archive_flood_table['End Year'] = archive_flood_table.Began.dt.year
archive_flood_table<jupyter_output><empty_output><jupyter_text>Coherence : 'philippines' 1985<jupyter_code>phi_archive_flood_table=archive_flood_table[archive_flood_table['Country']=='philippines'].sort_values(by=['Start Year','Start Month','Start Day'])
print('from',phi_archive_flood_table['Start Year'].min(),'to',phi_archive_flood_table['End Year'].max())
(phi_archive_flood_table[['Start Year','Start Month','Start Day','Dead','Displaced','Validation']])[phi_archive_flood_table['Start Year']==1985]
phi_flood_table_withday=flood_table[flood_table['Country']=='philippines' ].sort_values(by=['Start Year','Start Month','Start Day'])
print('from',phi_flood_table['Start Year'].min(),'to',phi_flood_table['End Year'].max())
(phi_flood_table[['Start Year','Start Month','Start Day','Total Deaths','No Affected','No Homeless']])[phi_flood_table['Start Year']==1985]<jupyter_output>from 1968 to 2019<jupyter_text>2019<jupyter_code>(phi_archive_flood_table[['Start Year','Start Month','Start Day','Dead','Displaced','Validation']])[phi_archive_flood_table['Start Year']==2019]
(phi_flood_table[['Start Year','Start Month','Start Day','Total Deaths','No Affected','No Homeless']])[phi_flood_table['Start Year']==2019]<jupyter_output><empty_output><jupyter_text>2010<jupyter_code>(phi_archive_flood_table[['Start Year','Start Month','Start Day','Dead','Displaced','Validation']])[phi_archive_flood_table['Start Year']==2010]
(phi_flood_table[['Start Year','Start Month','Start Day','Total Deaths','No Affected','No Homeless']])[phi_flood_table['Start Year']==2010]<jupyter_output><empty_output><jupyter_text>2000<jupyter_code>(phi_archive_flood_table[['Start Year','Start Month','Start Day','Dead','Displaced','Validation']])[phi_archive_flood_table['Start Year']==2000]
(phi_flood_table[['Start Year','Start Month','Start Day','Total Deaths','No Affected','No Homeless']])[phi_flood_table['Start Year']==2000]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.174906094753423, 'fraction_numerical': 0.004725554343874954, 'mean_word_length': 14.199815837937384, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '399424', 'license': 'MIT', 'n_tokens_mistral': 5865, 'n_tokens_neox': 5445, 'n_words': 750, 'path': 'model_innondations/notebook/FloodArchive_vs_emdat.ipynb', 'repo_name': 'alencon/batch8_worldbank', 'size': '16506'}