Question: jupyter for python 1. Use function melt to reshape columns Mon, Tue, Wed, Thu, Fri, Sat, and Sun into columns Day, containing day of the
jupyter for python


1. Use function melt to reshape columns "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", and "Sun" into columns "Day", containing day of the week, and "Hours", containing the number of hours studied on that day. Name the resulting data frame study_hours_reshaped. Hint: when calling melt, specify key as "Day", and value as "Hours". 2. Print the top 5 observation and print dimensions of study_hours_reshaped using function shape attribute Hint: it should have 42 rows and 5 columns. Output: study_hours_reshaped.head() Name Year Major Day Hours 0 Alice freshman CS Mon 1 Bob Senior MATH Mon 2 Carol sophomore CS Mon 3 David junior ECON Mon 4 Emily freshman MATH Mon Name Year Alice freshman Bob senior Carol sophomore David junior Emily freshman study_hours Major Mon Tue Wed Thu Fri Sat Sun cs 4 2 6 4 3 3 MATH 6 6 3 5 3 5 CS 7 4 3 7 3 5 ECON 10 937 MATH 4 6 9 3 3 1 1 EE 0 2 1 4 2 1 0 13 Fred senior
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
