Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i have a question about python programming. it\'s about how to use numpy to perf

ID: 3711467 • Letter: I

Question

i have a question about python programming.

it's about how to use numpy to perform data analysis. please help me with this

You are given a Python variable with the name rainfall. The variable rainfall is a numpy array of shape (4,7). The entries of rainfall are I 0.01, 0.21, 1.22, 1.18, 0.79, .82, 0.17], 0.13, 0.15, 0.22, 0.06, 0.21, 0.19, 0.23], 0.56, 0.18, 4.13, 3.57, 0.79, 0.02, 0.17] 0.67, 0.14, 4.22, 1.37, 0.63, 0.24, 0.25]] The entry rainfall[w.d] (where w = 0,1,2,3 and d = 0,1, ,6) contains the amount of rainfall in day d of week w. For example, the amount of rainfall in day 5 in week 0 is stored in rainfall[0,5], which equals to 0.02 You want to use numpy to determine the day (which can take the value of 0, 1, 2,3, 4, 5 or 6) that has the least value of mean rainfall over 4 weeks. For the array shown above, the expected answer is 5 Which of the following statement can you use? Note: There is only one correct answer O numpy.min(numpy.mean(rainfall,axis-0)) O numpy.min(numpy.mean(rainfall,axis-1)) O numpy.argmin(numpy.mean(rainfall,axis 0)) numpy.argmin(numpy.mean(rainfall, axis-1)

Explanation / Answer

Answer: Option 1 - numpy.min(numpy.mean(rainfall, axis=0))

Explanation: This statement will give the least value of mean rainfall across the rows for over all the 4 weeks, which is 0.1175 for day 5 . Since the answer is required across the rows so the axis=0 is used in the statement.

The statement will first calculate the mean across the rows, then it will select the minimum of it.