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

filepath_1 = '/kaggle/input/world-happiness-report-2022/World Happiness Report 2022.csv'
data_2022 = pd.read_csv(filepath_1)

data_2022.shape

data_2022.notnull()

data_2022.isnull().sum()

data_2022.dtypes

data_2022 = data_2022.round(2)

data_2022.dtypes

data_2022.corr().style.background_gradient(cmap='coolwarm', axis=None)

columns_to_drop = ['Whisker-high', 'Whisker-low', 'Dystopia (1.83) + residual', 'Explained by: Generosity', 'Explained by: Perceptions of corruption']
data_2022.drop(columns_to_drop, axis='columns', inplace=True)

column_rename = {'Explained by: GDP per capita': 'GDP_per_capita', 'Explained by: Social support': 'Social_support', 'Explained by: Healthy life expectancy': 'life_expectancy', 'Explained by: Freedom to make life choices': 'Freedom', 'Explained by: Generosity': 'Generosity', 'Happiness score': 'Happiness_score_2022'}
data_2022.rename(columns=column_rename, inplace=True)
data_2022

data_2022.sort_values(by='RANK', inplace=True)
data_2022.head(10)