# -*- coding: utf-8 -*- IR IR I # note: do not import other packages; my test script uses only these import numpy as np
Posted: Fri May 20, 2022 5:13 pm
# -*- coding: utf-8 -*- IR IR I # note: do not import other packages; my test script uses only these import numpy as np import pandas as pd # allow output to span multiple output lines in the console pd.set_option('display.max_columns', 500) # # # read the data # df = pd.read_csv("https://raw.githubusercontent.com/fivet ... -grads.csv") = # # # series # # let's start with two series # (without the copy, we are just getting a view of a column, # and it will cause problems later, for example in sorting) unemp = df['Unemployment_rate'].copy major = df['Major'].copy) = #@ @ # Compute the number of majors associated with each major # category. The first lines of your result should look like this: # Engineering 29 # Education 16 # Humanities & Liberal Arts 15 # Biology & Life Science 14 # #@ # Add a new variable 'HighShareWomen' to the data frame. # This variable should be True if ShareWomen > 0.50, and # False otherwise. Then compute the first five values in . # the HishShareWoman column. ############################################################### # In the remaining problems you can assume that df additionally # contains the column 'HighShareWomen' ############################################################### #@ # Compute the fraction of majors that have a high share of women. # Your result should be a number close to 0.56 #@ # For each major, compute the fraction of those working in # low-end jobs. Show the 10 majors with the most low wage # jobs, ordered by decreasing fraction of low-end jobs. # Your result should be a series that begins like this: # Major # COSMETOLOGY SERVICES AND CULINARY ARTS 0.300951 # DRAMA AND THEATER ARTS 0.255913 # MISCELLANEOUS FINE ARTS 0.226048 # CLINICAL PSYCHOLOGY 0.219168 # STUDIO ARTS 0.211227 #@ # For each major category, compute the maximum of the median # salaries for majors within that category. Sort by decreasing # # median salary. # Your result should be a series that begins like this: # Major_category # Engineering 110000 # Physical Sciences 62000 # Business 62000 $ #@ # Compute the average median salary for each major category, # sorted by increasing salary. # Your result should be a series that begins like this: # Major_category # Psychology & Social Work 30100.000000 # Humanities & Liberal Arts 31913.333333 # Education 32350.000000