Learn practical skills, build real-world projects, and advance your career
import jovian
import pandas as pd
import numpy as np 
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.display import display
pd.options.display.max_rows = 10
flood_df = pd.read_excel('FloodArchive.xlsx')
country_df = pd.read_csv('country.csv')

row_country_serbia = {'Code':'SRB', 'Name':'Serbia', 'Continent':'Europe', 'Region':'Southern Europe'}
country_df = country_df.append(row_country_serbia, ignore_index = True)
country_df.at[country_df[country_df['Name'] == 'Côte d’Ivoire'].index,'Name'] = 'Ivory Coast'
fdf_country = flood_df['Country']
cdf_name = country_df['Name']

for i in range(len(fdf_country)):
    fdf_country[i] = fdf_country[i].strip()
   
    if fdf_country[i] == 'USA':
        fdf_country[i] = 'United States'
    if fdf_country[i] == 'Soviet Union' or fdf_country[i] == 'Russia' or fdf_country[i] == 'USSR':
        fdf_country[i] = 'Russian Federation'
    if fdf_country[i] == 'UK' or fdf_country[i] == 'England' or fdf_country[i] == 'Britain' or fdf_country[i] == 'Scotland':
        fdf_country[i] = 'United Kingdom'
    if fdf_country[i] == 'Burma':
        fdf_country[i] = 'Myanmar'
    if fdf_country[i] == 'Fiji':
        fdf_country[i] = 'Fiji Islands'
    if fdf_country[i] == 'Columbia':
        fdf_country[i] = 'Colombia'
    if fdf_country[i] == 'Kazahkstan'or fdf_country[i] == 'Kazakhstan':
        fdf_country[i] = 'Kazakstan'
    if fdf_country[i] == 'Phillipines':
        fdf_country[i] = 'Philippines'
    if fdf_country[i] == 'Viet Nam':
        fdf_country[i] = 'Vietnam'
    if fdf_country[i] == 'Democratic Republic of Congo' or fdf_country[i] == 'DR Congo':
        fdf_country[i] = 'Congo, The Democratic Republic of the'
    if fdf_country[i] == 'West Germany':
        fdf_country[i] = 'Germany'
    if fdf_country[i] == 'Zimbawe':
        fdf_country[i] = 'Zimbabwe'
    if fdf_country[i] == 'Guatamala':
        fdf_country[i] = 'Guatemala'
    if fdf_country[i] == 'South Sudan':
        fdf_country[i] = 'Sudan'
    if fdf_country[i] == 'Trinidad':
        fdf_country[i] = 'Trinidad and Tobago'
    if 'Bosnia' in fdf_country[i]: 
        fdf_country[i] = 'Bosnia and Herzegovina'
    if 'Democratic Republic' in fdf_country[i]:
        fdf_country[i] = 'Congo, The Democratic Republic of the'
 
        
fdf_country_unique = fdf_country.unique()
<ipython-input-27-bf065b3eb860>:5: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = fdf_country[i].strip() <ipython-input-27-bf065b3eb860>:22: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Philippines' <ipython-input-27-bf065b3eb860>:8: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'United States' <ipython-input-27-bf065b3eb860>:28: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Germany' <ipython-input-27-bf065b3eb860>:24: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Vietnam' <ipython-input-27-bf065b3eb860>:36: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Trinidad and Tobago' <ipython-input-27-bf065b3eb860>:18: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Colombia' <ipython-input-27-bf065b3eb860>:32: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Guatemala' <ipython-input-27-bf065b3eb860>:10: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Russian Federation' <ipython-input-27-bf065b3eb860>:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'United Kingdom' <ipython-input-27-bf065b3eb860>:16: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Fiji Islands' <ipython-input-27-bf065b3eb860>:14: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Myanmar' <ipython-input-27-bf065b3eb860>:20: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Kazakstan' <ipython-input-27-bf065b3eb860>:38: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Bosnia and Herzegovina' <ipython-input-27-bf065b3eb860>:40: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Congo, The Democratic Republic of the' <ipython-input-27-bf065b3eb860>:26: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Congo, The Democratic Republic of the' <ipython-input-27-bf065b3eb860>:34: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Sudan' <ipython-input-27-bf065b3eb860>:30: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy fdf_country[i] = 'Zimbabwe'
country_abnormal = []

for i in range(len(fdf_country)): 
    dum = 0
    for j in cdf_name:
        if j == fdf_country[i]:
            dum = 1
            break
    if dum == 0:
        country_abnormal.append(i)
        
        
for i in country_abnormal:
    
list