@@ -17,7 +17,8 @@ keypoints:
1717- " Use `array[x, y]` to select a single element from a 2D array."
1818- " Array indices start at 0, not 1."
1919- " Use `low:high` to specify a `slice` that includes the indices from `low` to `high-1`."
20- - " Use `numpy.mean(array)`, `numpy.max(array)`, and `numpy.min(array)` to calculate simple statistics."
20+ - " Use `# some kind of explanation` to add comments to programs."
21+ - " Use `numpy.mean(array)`, `numpy.amax(array)`, and `numpy.amin(array)` to calculate simple statistics."
2122- " Use `numpy.mean(array, axis=0)` or `numpy.mean(array, axis=1)` to calculate statistics across the specified axis."
2223---
2324
@@ -357,16 +358,16 @@ We'll also use multiple assignment,
357358a convenient Python feature that will enable us to do this all in one line.
358359
359360~~~
360- maxval, minval, stdval = numpy.max (data), numpy.min (data), numpy.std(data)
361+ maxval, minval, stdval = numpy.amax (data), numpy.amin (data), numpy.std(data)
361362
362363print('maximum inflammation:', maxval)
363364print('minimum inflammation:', minval)
364365print('standard deviation:', stdval)
365366~~~
366367{: .language-python}
367368
368- Here we've assigned the return value from `numpy.max (data)` to the variable `maxval`, the value
369- from `numpy.min (data)` to `minval`, and so on.
369+ Here we've assigned the return value from `numpy.amax (data)` to the variable `maxval`, the value
370+ from `numpy.amin (data)` to `minval`, and so on.
370371
371372~~~
372373maximum inflammation: 20.0
@@ -400,7 +401,7 @@ then ask it to do the calculation:
400401
401402~~~
402403patient_0 = data[ 0, :] # 0 on the first axis (rows), everything on the second (columns)
403- print('maximum inflammation for patient 0:', numpy.max (patient_0))
404+ print('maximum inflammation for patient 0:', numpy.amax (patient_0))
404405~~~
405406{: .language-python}
406407
@@ -413,7 +414,7 @@ We don't actually need to store the row in a variable of its own.
413414Instead, we can combine the selection and the function call:
414415
415416~~~
416- print('maximum inflammation for patient 2:', numpy.max (data[ 2, :] ))
417+ print('maximum inflammation for patient 2:', numpy.amax (data[ 2, :] ))
417418~~~
418419{: .language-python}
419420
@@ -428,7 +429,7 @@ diagram on the right)? As the diagram below shows, we want to perform the
428429operation across an axis:
429430
430431
433434
434435To support this functionality,
@@ -747,11 +748,11 @@ which is the average inflammation per patient across all days.
747748> it matter if the change in inflammation is an increase or a decrease?
748749>
749750> > ## Solution
750- > > By using the `numpy.max ()` function after you apply the `numpy.diff()`
751+ > > By using the `numpy.amax ()` function after you apply the `numpy.diff()`
751752> > function, you will get the largest difference between days.
752753> >
753754> > ~~~
754- > > numpy.max (numpy.diff(data, axis=1), axis=1)
755+ > > numpy.amax (numpy.diff(data, axis=1), axis=1)
755756> > ~~~
756757> > {: .language-python}
757758> >
@@ -774,7 +775,7 @@ which is the average inflammation per patient across all days.
774775> > between readings.
775776> >
776777> > ~~~
777- > > numpy.max (numpy.absolute(numpy.diff(data, axis=1)), axis=1)
778+ > > numpy.amax (numpy.absolute(numpy.diff(data, axis=1)), axis=1)
778779> > ~~~
779780> > {: .language-python}
780781> >
0 commit comments