Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help with my assignment. I need to make a pairwise scatterplot using sns.pairplot for the World Happiness data. My task is to

Hi, I need help with my assignment. I need to make a pairwise scatterplot using sns.pairplot for the World Happiness data. My task is to do the following.

  • Define a variable called explanatory_vars that contains the list of the 6 key explanatory variables.
  • Define a variable called plot_vars that contains Happiness and each of the explanatory variables. (Hint: recall that you can concatenate Python lists using the addition (+) operator.)
  • Using sns.pairplot, make a pairwise scatterplot for the WHR dataframe over the variables of interest, namely the plot_vars. To add additional information, set the hue option to reflect the year of each data point, so that trends over time might become apparent. It will also be useful to include the options dropna=True and palette='Blues'.

The explanatory variables are (in our new naming scheme): 'LogGDP', 'Support', 'Life', 'Freedom', 'Generosity', and 'Corruption'.

The columns included on the report are:

cols_to_include = ['country', 'year', 'Life Ladder', 'Positive affect','Negative affect', 'Log GDP per capita', 'Social support', 'Healthy life expectancy at birth', 'Freedom to make life choices', 'Generosity', 'Perceptions of corruption']

renaming = {'Life Ladder': 'Happiness', 'Log GDP per capita': 'LogGDP', 'Social support': 'Support', 'Healthy life expectancy at birth': 'Life', 'Freedom to make life choices': 'Freedom', 'Perceptions of corruption': 'Corruption', 'Positive affect': 'Positive', 'Negative affect': 'Negative'}

Can you please help me out? Thank you!

Note this is for pandas, python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Restaurant Financial Management

Authors: Hyung-il Jung

1st Edition

1774631431, 978-1774631430

More Books

Students also viewed these Finance questions