Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write and evaluate code to do the following: From the transposed summary data, drop the row labeled 'year'. From the resulting dataframe, drop the columns
Write and evaluate code to do the following:
- From the transposed summary data, drop the row labeled 'year'.
- From the resulting dataframe, drop the columns labeled '25%', '50%', and '75%'.
- Using the rename method on the resulting dataframe, rename the columns according to the mapping defined in column_renaming.
- Select out the columns in the list defined by column_order and assign the resulting dataframe to the variable dfsummary.
In [5]: df.T Out [5]: Negative affect Log GDP per capita Social support Healthy life expectancy at birth Freedom to make life choices Generosity Perceptions corruption 0 country Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan year Life Ladder Positive affect of 2008 3.72 0.52 0.26 7.17 0.45 49.21 0.72 0.18 0.88 1 11 rows x 1562 columns 2009 4.40 0.58 0.24 7.33 0.55 49.62 0.68 0.20 2 0.85 2010 4.76 0.62 0.28 7.39 0.54 50.01 0.60 0.14 3 0.71 2011 3.83 0.61 0.27 7.42 0.52 50.37 0.50 0.18 4 0.73 2012 3.78 0.71 0.27 7.52 0.52 50.71 0.53 0.25 5 0.78 2013 3.57 0.62 0.27 7.50 0.48 51.04 0.58 0.07 6 0.82 2014 3.13 0.53 0.37 7.48 0.53 51.37 0.51 0.12 0.87
Step by Step Solution
★★★★★
3.36 Rating (146 Votes )
There are 3 Steps involved in it
Step: 1
To achieve the tasks you described you can use the Pandas library in Python First transpose the Data...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started