Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with python 3 H.W. This is the table for the previous Q --------------------------------------------------------------------------------------------------- Question 2. At the moment, the name column is

Please help me with python 3 H.W.

image text in transcribed

This is the table for the previous Q

image text in transcribed

---------------------------------------------------------------------------------------------------

image text in transcribed

image text in transcribed

Question 2. At the moment, the name column is sorted by last name. Would the arrays you generated in the previous part be the same if we had sorted by first name instead before generating them? Two arrays are the same if they contain the same number of elements and the elements located at corresponding indexes in the two arrays are identical. Explain your answer. No, they will not be the same. They would have the same number of elements but the element located at corresponding indexes in the two arrays would not be identical. Question 3. Set biggest_range_dept to the name of the department with the largest salary range, where range is defined as the difference between the highest salary and the lowest salary in the department. Hint: First you'll need to define a new function salary range which takes in an array of salaries and returns the range of salaries in that array. Then, set department ranges to a table containing the names and salary ranges of each department. In [45]: # Define salary range first def salary_range (array): high-max(array) low = min(array) return abs (high-low) department ranges = profs.drop('name', 'position').group('department', salary_range) biggest_range_dept = department_ranges.drop( 'range' descending=True).column('department') biggest range_dept File "", line 3 high = max(array) IndentationError: expected an indented block In [42]: # Pick one of the two functions defined below in your call to group. def identity(array): Returns the array that is passed through return array def first (array): Returns the first item!!! return array.item( 0 ) # Make a call to group using one of the functions above when you define prof names prof_names profs.group( 'department', first).drop('position').drop('gross_salary') prof names Out[42]: department name first position first gross_salary first 39646 239542 95518 111708 59458 African American Studies AYA DE LEON lecturer Agricultural and Resource Economics and Policy MAXIMILIAN AUFFHAMMER professor Anthroplogy SABRINA AGARWAL associate professor Architecture MARK ANDERSON professor Art History DILIANA ANGELOVA assistant professor Art Practice ALLAN DESOUZA associate professor Astronomy GIBOR BASRI professor Bioengineering ADAM ARKIN professor Biology DAVID ACKERLY professor Buddhist Studies JANN RONIS lecturer 93282 225942 264677 182288 53555 ... (61 rows omitted) Cause of Death AID Cause of Death (Full Description) Acquired Immune Deficiency Syndrome (AIDS) Alzheimer's Disease ALZ Malignant Neoplasms (Cancers) Chronic Lower Respiratory Disease (CLRD) Chronic Obstructive Pulmonary Disease (COPD) DIA HIV Diabetes Mellitus Human Immunodeficiency Virus Disease (HIVD) HOM Homicide HTD Diseases of the Heart HYP INJ Essential Hypertension and Hypertensive Renal Disease Unintentional Injuries Chronic Liver Disease and Cirrhosis LIV Kidney Disease (Nephritis) All Other Causes NEP OTH PNF STK SUI Pneumonia and Influenza Cerebrovascular Disease (Stroke) Intentional Self Harm (Suicide) Question 1. Let's clean up our data. First, remove rows with HOM, HYP, and NEP as the cause of death from the table for the reasons described above. Next, join together the abbreviations table and our causes of death table so that we have a more detailed description of each disease in each row. Lastly, drop the column which contains the abbreviation of the disease, and rename the column that contains the full description to 'Cause of Death'. Assign the resulting table to the name cleaned causes. Hint: You should expect this to take more than one line. Use many lines and many intermediate tables to complete this question. In [36]: cleaned causes = cleaned causes File "Zipython-input-36-093b6d149435>", line 2

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

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

b is: (a) 2.049 (b) 0.31928 (c) 0.01659 (d) None of these

Answered: 1 week ago

Question

What are some of the possible scenes from our future?

Answered: 1 week ago

Question

1. What are your creative strengths?

Answered: 1 week ago