Question: Python Question - Numpy No Loops, please. Use only Numpy to solve the question below. The file degrees.txt (pasted below) contains a list of degrees

Python Question - Numpy

No Loops, please. Use only Numpy to solve the question below.

The file degrees.txt (pasted below) contains a list of degrees and the numbers of those degrees awarded in 1981 and 2010. Write a function named pct_change that accepts one parameter (a filename) and returns a tuple consisting of two ndarrays: one listing the name of the degree and the other listing the percent change from 1981 to 2010. Both arrays should be ordered with the highest growth degree first.

As with the previous exercise, you may find it helpful to separate the description data from the numeric data. Here is a sample call:

In [1]: pct_change('degrees.txt') Out[1]: array(['Computer Science', 'Business', 'Social Sciences', 'Engineering', 'Education'], dtype='|S16'), array([ 161.8146948 , 78.6810359 , 71.89816243, 14.16046007, -6.30031275]))

Please find attached the degrees.txt file below:

Business,200521,358293 Computer Science,15121,39589 Education,108074,101265 Engineering,63642,72654 Social Sciences,100513,172780

Point of Stress: Please attached a print screen in addition to the code as evidence the scripts ran properly and as intended. Thank you.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!