@@ -18,7 +18,7 @@ keypoints:
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`."
2020- " Use `# some kind of explanation` to add comments to programs."
21- - " Use `numpy.mean(array)`, `numpy.max (array)`, and `numpy.min (array)` to calculate simple statistics."
21+ - " Use `numpy.mean(array)`, `numpy.amax (array)`, and `numpy.amin (array)` to calculate simple statistics."
2222- " Use `numpy.mean(array, axis=0)` or `numpy.mean(array, axis=1)` to calculate statistics across the specified axis."
2323---
2424
@@ -359,16 +359,16 @@ We'll also use multiple assignment,
359359a convenient Python feature that will enable us to do this all in one line.
360360
361361~~~
362- maxval, minval, stdval = numpy.max (data), numpy.min (data), numpy.std(data)
362+ maxval, minval, stdval = numpy.amax (data), numpy.amin (data), numpy.std(data)
363363
364364print('maximum inflammation:', maxval)
365365print('minimum inflammation:', minval)
366366print('standard deviation:', stdval)
367367~~~
368368{: .language-python}
369369
370- Here we've assigned the return value from `numpy.max (data)` to the variable `maxval`, the value
371- from `numpy.min (data)` to `minval`, and so on.
370+ Here we've assigned the return value from `numpy.amax (data)` to the variable `maxval`, the value
371+ from `numpy.amin (data)` to `minval`, and so on.
372372
373373~~~
374374maximum inflammation: 20.0
@@ -402,7 +402,7 @@ then ask it to do the calculation:
402402
403403~~~
404404patient_0 = data[ 0, :] # 0 on the first axis (rows), everything on the second (columns)
405- print('maximum inflammation for patient 0:', numpy.max (patient_0))
405+ print('maximum inflammation for patient 0:', numpy.amax (patient_0))
406406~~~
407407{: .language-python}
408408
@@ -420,7 +420,7 @@ We don't actually need to store the row in a variable of its own.
420420Instead, we can combine the selection and the function call:
421421
422422~~~
423- print('maximum inflammation for patient 2:', numpy.max (data[ 2, :] ))
423+ print('maximum inflammation for patient 2:', numpy.amax (data[ 2, :] ))
424424~~~
425425{: .language-python}
426426
@@ -435,7 +435,7 @@ diagram on the right)? As the diagram below shows, we want to perform the
435435operation across an axis:
436436
437437
440440
441441To support this functionality,
@@ -754,11 +754,11 @@ which is the average inflammation per patient across all days.
754754> it matter if the change in inflammation is an increase or a decrease?
755755>
756756> > ## Solution
757- > > By using the `numpy.max ()` function after you apply the `numpy.diff()`
757+ > > By using the `numpy.amax ()` function after you apply the `numpy.diff()`
758758> > function, you will get the largest difference between days.
759759> >
760760> > ~~~
761- > > numpy.max (numpy.diff(data, axis=1), axis=1)
761+ > > numpy.amax (numpy.diff(data, axis=1), axis=1)
762762> > ~~~
763763> > {: .language-python}
764764> >
@@ -781,7 +781,7 @@ which is the average inflammation per patient across all days.
781781> > between readings.
782782> >
783783> > ~~~
784- > > numpy.max (numpy.absolute(numpy.diff(data, axis=1)), axis=1)
784+ > > numpy.amax (numpy.absolute(numpy.diff(data, axis=1)), axis=1)
785785> > ~~~
786786> > {: .language-python}
787787> >
0 commit comments