diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2021-10-13 19:53:57 -0700 |
---|---|---|
committer | Ross Barnowski <rossbar@berkeley.edu> | 2021-10-13 20:14:13 -0700 |
commit | d03e7887e12f9e9041113658775ba8cc478d5c58 (patch) | |
tree | dbd7820ae19ceccb0cb577db09ac4b9f692f8b3f | |
parent | e8692223ffb675dca714bf13bb8f19e73b273095 (diff) | |
download | numpy-d03e7887e12f9e9041113658775ba8cc478d5c58.tar.gz |
Modify code to match img illustrating reduction along axis.
Co-authored-by: MarsBarLee <mlee@quansight.com>
-rw-r--r-- | doc/source/user/absolute_beginners.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/source/user/absolute_beginners.rst b/doc/source/user/absolute_beginners.rst index bb570f622..7b9e33232 100644 --- a/doc/source/user/absolute_beginners.rst +++ b/doc/source/user/absolute_beginners.rst @@ -899,12 +899,18 @@ You can aggregate matrices the same way you aggregated vectors:: .. image:: images/np_matrix_aggregation.png You can aggregate all the values in a matrix and you can aggregate them across -columns or rows using the ``axis`` parameter:: +columns or rows using the ``axis`` parameter. To illustrate this point, let's +look at slightly modified dataset:: + >>> data = np.array([[1, 2], [5, 3], [4, 6]]) + >>> data + array([[1, 2], + [5, 3], + [4, 6]]) >>> data.max(axis=0) array([5, 6]) >>> data.max(axis=1) - array([2, 4, 6]) + array([2, 5, 6]) .. image:: images/np_matrix_aggregation_row.png |