Hint:The relevant column labels are "Cerebrovascular Disease (Stroke)" and "Chronic LiverDisease and Cirrhosis"In :distributions.select("Year","Cerebrovascular Disease (Stroke)","Chronic Liver Diseas# Don't change the code below this comment.plt.title("% of total deaths / disease per year")plt.xlabel("% of total deaths")Out:Text(0.5, 0,'% of total deaths')6
1.22. Faculty salariesIn the next cell, we load a dataset created by theDaily Calwhich contains Berkeley faculty, theirdepartments, their positions, and their gross salaries in 2015.In :raw_profs=Table.read_table("faculty.csv").where("year", are.equal_to(2015)).drop("yeprofs=raw_profs.relabel("title_category","position")profsOut:name| department| position| gross_salaryCYNTHIA ABAN| South & Southeast Asian Studies | lecturer| 64450PIETER ABBEEL| Computer Science| associate professor | 184998SALLY ABEL| Law| lecturer| 3466ELIZABETH ABEL| English| professor| 138775DOR ABRAHAMSON| Education| associate professor | 100300KATHRYN ABRAMS| Law| professor| 319693BARBARA ABRAMS| Public Health| professor| 191162SARAH ACCOMAZZO | Social Welfare| lecturer| 14779CHARISMA ACEY| City and Regional Planning| assistant professor | 101567DAVID ACKERLY| Biology| professor| 182288... (2049 rows omitted)We want to use this table to generate arrays with the names of each professor in each depart-ment.7
Question 1.Setprof_namesto a table with two columns. The first column should be calleddepartmentand have the name of every department once, and the second column should be calledfacultyand contain anarrayof the names of all faculty members in that department.Hint:Think about howgroupworks: it collects values into an array and then applies a functionto that array. We have defined two functions below for you, and you will need to use one of themin your call togroup.In :# Pick one of the two functions defined below in your call to group.defidentity(array):returnarraydeffirst(array):returnarray.item(0)In :prof_names=profs.drop("position","gross_salary").group("department", identity).relabprof_namesOut:department| facultyAfrican American Studies| ['AYA DE LEON' 'CHIYUMA ELLIOTT' 'NIKAgricultural and Resource Economics and Policy | ['MAXIMILIAN AUFFHAMMER' 'CHARLES GIBAnthroplogy| ['SABRINA AGARWAL' 'STANLEY BRANDES''...Architecture| ['MARK ANDERSON' 'JACOB ATHERTON' 'WIArt History| ['DILIANA ANGELOVA' 'PATRICIA BERGER'Art Practice| ['ALLAN DESOUZA' 'AIDA GAMEZ' 'RANDYAstronomy| ['GIBOR BASRI' 'STEVEN BECKWITH' 'LEOBioengineering| ['ADAM ARKIN' 'IRINA CONBOY' 'STEVENBiology| ['DAVID ACKERLY' 'HILLEL ADESNIK' 'KEBuddhist Studies| ['JANN RONIS']... (61 rows omitted)In :_=ok.grade('q2_1')~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Running tests---------------------------------------------------------------------Test summaryPassed: 1Failed: 0[ooooooooook] 100.0% passedQuestion 2.At the moment, thenamecolumn is sorted by last name. Would the arrays yougenerated in the previous part be the same if we had sorted by first name instead before generatingthem? Two arrays are thesameif they contain the same number of elements and the elements8
located at corresponding indexes in the two arrays are identical. Explain your answer. If you feelyou need to make certain assumptions about the data, feel free to state them in your response.
- Fall '17