In 39 numbers makearray 42 4224 42422424 250 products

This preview shows page 6 - 10 out of 19 pages.

In [39]:numbers=make_array(42,4224,42422424,-250)products=157*numbersproductsOut[39]:array([6594,663168, 6660320568,-39250])In [40]:ok.grade("q3_2");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Running tests---------------------------------------------------------------------Test summaryPassed: 1Failed: 0[ooooooooook] 100.0% passed
Question 3.Oops, we made a typo! Instead of 157, we wanted to multiply each number by 1577.Compute the correct products in the cell below using array arithmetic. Notice that your job is reallyeasy if you previously defined an array containing the 4 numbers.In [41]:correct_products=products/157*1577correct_productsOut[41]:array([ 6.62340000e+04,6.66124800e+06,6.69001626e+10, -3.94250000e+05])In [42]:ok.grade("q3_3");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Running tests---------------------------------------------------------------------Test summaryPassed: 1Failed: 0[ooooooooook] 100.0% passedQuestion 4.We've loaded an array of temperatures in the next cell. Each number is the highesttemperature observed on a day at a climate observation station, mostly from the US. Since they'refrom the US government agencyNOAA, all the temperatures are in Fahrenheit. Convert them all toCelsius by first subtracting 32 from them, then multiplying the results by5959. Make sure toROUNDthe final result after converting to Celsius to the nearest integer using thenp.round function.In [43]:max_temperatures=Table.read_table("temperatures.csv").column("Daily MaxTemperature")celsius_max_temperatures=np.round((max_temperatures-32)*5/9)celsius_max_temperaturesOut[43]:array([-4., 31., 32., ..., 17., 23., 16.])In [44]:ok.grade("q3_4");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Running tests---------------------------------------------------------------------Test summary
Passed: 4Failed: 0[ooooooooook] 100.0% passedQuestion 5.The cell below loads all thelowesttemperatures from each day (in Fahrenheit).Compute the size of the daily temperature range for each day. That is, compute the differencebetween each daily maximum temperature and the corresponding daily minimum temperature.Payattention to the units, give your answer in Celsius!Make sureNOTto round your answer for thisquestion!=
4. World PopulationRemember that the tests from this point on willnotnecessarily tell you whether or not your answersare correct.The cell below loads a table of estimates of the world population for different years, starting in 1950.The estimates come from theUS Census Bureau websiteIn [47]:world=Table.read_table("world_population.csv").select('Year','Population'world.show(4)YearPopulation.)
19502557628654195125949398771952263677230619532682053389... (62 rows omitted)The name population is assigned to an array of population estimates.In [48]:population=world.column(1)populationOut[48]:array([2557628654, 2594939877, 2636772306, 2682053389, 2730228104,2782098943, 2835299673, 2891349717, 2948137248, 3000716593,3043001508, 3083966929, 3140093217, 3209827882, 3281201306,3350425793, 3420677923, 3490333715, 3562313822, 3637159050,3712697742, 3790326948, 3866568653, 3942096442, 4016608813,4089083233, 4160185010, 4232084578, 4304105753, 4379013942,4451362735, 4534410125, 4614566561, 4695736743, 4774569391,4856462699, 4940571232, 5027200492, 5114557167, 5201440110,5288955934, 5371585922, 5456136278, 5538268316, 5618682132,5699202985, 5779440593, 5857972543, 5935213248, 6012074922,6088571383, 6165219247, 6242016348, 6318590956, 6395699509,6473044732, 6551263534, 6629913759, 6709049780, 6788214394,6866332358, 6944055583, 7022349283, 7101027895, 7178722893,7256490011])In this question, you will apply some built-in Numpy functions to this array. Numpy is a module that isoften used in Data Science!The difference function np.diff subtracts each element in an array from the element after it within thearray. As a result, the length of the array np.diff returns will always be one less than the length of theinput array.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 19 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
Max, World population, 3rd millennium, k eruptions

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture