diff options
author | Christopher Dahlin <christopher@tracsense.tech> | 2021-03-28 14:52:04 +0200 |
---|---|---|
committer | Christopher Dahlin <christopher@tracsense.tech> | 2021-03-28 14:52:04 +0200 |
commit | d0794c94932d349d045e773c54c7b0d3d24eebfe (patch) | |
tree | e99a541dba3b79c1d27bdcb5933cc35999a43c24 | |
parent | 9afc58010f7027711b22e2eea9e97c2940262928 (diff) | |
download | numpy-d0794c94932d349d045e773c54c7b0d3d24eebfe.tar.gz |
Changed doc code to be consistent with the images.
-rw-r--r-- | doc/source/user/absolute_beginners.rst | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/source/user/absolute_beginners.rst b/doc/source/user/absolute_beginners.rst index fda73c5fb..084bb6d22 100644 --- a/doc/source/user/absolute_beginners.rst +++ b/doc/source/user/absolute_beginners.rst @@ -871,10 +871,11 @@ Creating matrices You can pass Python lists of lists to create a 2-D array (or "matrix") to represent them in NumPy. :: - >>> data = np.array([[1, 2], [3, 4]]) + >>> data = np.array([[1, 2], [3, 4], [5, 6]]) >>> data array([[1, 2], - [3, 4]]) + [3, 4], + [5, 6]]) .. image:: images/np_create_matrix.png @@ -883,7 +884,8 @@ Indexing and slicing operations are useful when you're manipulating matrices:: >>> data[0, 1] 2 >>> data[1:3] - array([[3, 4]]) + array([[3, 4], + [5, 6]]) >>> data[0:2, 0] array([1, 3]) @@ -892,11 +894,11 @@ Indexing and slicing operations are useful when you're manipulating matrices:: You can aggregate matrices the same way you aggregated vectors:: >>> data.max() - 4 + 6 >>> data.min() 1 >>> data.sum() - 10 + 21 .. image:: images/np_matrix_aggregation.png @@ -904,9 +906,9 @@ You can aggregate all the values in a matrix and you can aggregate them across columns or rows using the ``axis`` parameter:: >>> data.max(axis=0) - array([3, 4]) + array([5, 6]) >>> data.max(axis=1) - array([2, 4]) + array([2, 4, 6]) .. image:: images/np_matrix_aggregation_row.png |