image_output_1.png
from termcolor import colored

import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import plotly.express as px

import seaborn as sns

import warnings

import warnings
warnings.simplefilter('ignore')
plt.style.use('seaborn')

Data = pd.read_csv('/kaggle/input/country-dataset/Country_Dataset.csv')
df = pd.DataFrame(Data)
df

df.describe().T

is_nan = df.isna().sum().to_frame(name='Count of nan')
is_nan

# Noise detection
df1 = pd.DataFrame(Data, columns = ['child_mort','exports','health','imports','income','inflation','life_expec','total_fer','gdpp'])
columns = ['child_mort','exports','health','imports','income','inflation','life_expec','total_fer','gdpp']
plt.figure(figsize=(15,20))
for i, col in enumerate (df1.columns):
    ax= plt.subplot(5,2,i+1)
    sns.boxplot(x= columns[i], data=df1, color='magenta' )
    plt.title(df1.columns[i])
    plt.tight_layout()
plt.show()

df1 = pd.DataFrame(Data, columns=['child_mort', 'exports', 'health', 'imports', 'income', 'inflation', 'life_expec', 'total_fer', 'gdpp'])
i = 1
for col in df1.columns:
    i = i + 1

for i in df.drop('Country', axis=1).columns:
    fig = px.choropleth(df, locationmode='country names', locations='Country', title=i + ' per Country in the World', color=i, color_continuous_scale='Greens')
    fig.update_geos(fitbounds='locations', visible=True)

for i in df.drop('Country', axis=1).columns:
    fig = px.choropleth(df, locationmode='country names', locations='Country', color=i, title=i + ' per country in Africa continent', scope='africa', color_continuous_scale='YlOrBr')
    fig.update_geos(fitbounds='locations', visible=True)
    fig.show(engine='kaleido')