text_html_output_1.png
import os

import pandas as pd

pathvals = ['/kaggle/input/internet-prices-datasets-for-analysis', './data']
fnames = ['average_after_tax_wages.csv', 'average_monthly_internet.csv', 'GDP_per_capita.csv', 'internet_adoption.csv']
average_monthly_internet = 'average_monthly_internet'
average_monthly_internet_costs = 'average_monthly_internet_costs'
average_after_tax_wages = 'average_after_tax_wages'
GDP_per_capita = 'GDP_per_capita'
internet_adoption = 'internet_adoption'
key_names = [average_monthly_internet_costs, average_after_tax_wages, GDP_per_capita, internet_adoption]

df_list = {}
df_list_orig = {}
path = ''
for pathval in pathvals:
    if os.path.exists(pathval):
        path = pathval
        break
for fname in fnames:
    df = pd.read_csv(os.path.join(path, fname))
    key = fname[:-4]
    if key == average_monthly_internet:
        key = average_monthly_internet_costs
    df_list_orig[key] = df
    df_list[key] = df.dropna(axis=1, how='all')
    df_list[key].set_index('Country', inplace=True)
df = df_list[GDP_per_capita]
columns = df.columns
for column in columns:
    df[column] = df[column].str.replace(',', '')
    df[column] = df[column].astype(float)