summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprateek arora <aprateek29@gmail.com>2020-11-04 01:37:33 +0530
committerGitHub <noreply@github.com>2020-11-03 12:07:33 -0800
commitf8c608cc7a8abcfaea1cd655ddaab47065c5b1e5 (patch)
treefefb9a8b671f388d133fab9af5e564a3ba7f4fde
parent8b15e57718042c75af22a25a7d604fa0f938f16e (diff)
downloadnumpy-f8c608cc7a8abcfaea1cd655ddaab47065c5b1e5.tar.gz
Add info on transopose to absolute beginners tutorial (#17703)
Adds a blurb about the transpose property of ndarray and updates formatting of some rst inline literals. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
-rw-r--r--doc/source/user/absolute_beginners.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/doc/source/user/absolute_beginners.rst b/doc/source/user/absolute_beginners.rst
index 5873eb108..126f5f2a3 100644
--- a/doc/source/user/absolute_beginners.rst
+++ b/doc/source/user/absolute_beginners.rst
@@ -1090,7 +1090,7 @@ To learn more about finding the unique elements in an array, see `unique`.
Transposing and reshaping a matrix
----------------------------------
-*This section covers* ``arr.reshape()``, ``arr.transpose()``, ``arr.T()``
+*This section covers* ``arr.reshape()``, ``arr.transpose()``, ``arr.T``
-----
@@ -1114,7 +1114,7 @@ You simply need to pass in the new dimensions that you want for the matrix. ::
.. image:: images/np_reshape.png
-You can also use ``.transpose`` to reverse or change the axes of an array
+You can also use ``.transpose()`` to reverse or change the axes of an array
according to the values you specify.
If you start with this array::
@@ -1131,6 +1131,13 @@ You can transpose your array with ``arr.transpose()``. ::
[1, 4],
[2, 5]])
+You can also use ``arr.T``::
+
+ >>> arr.T
+ array([[0, 3],
+ [1, 4],
+ [2, 5]])
+
To learn more about transposing and reshaping arrays, see `transpose` and
`reshape`.
@@ -1138,12 +1145,12 @@ To learn more about transposing and reshaping arrays, see `transpose` and
How to reverse an array
-----------------------
-*This section covers* ``np.flip``
+*This section covers* ``np.flip()``
-----
NumPy's ``np.flip()`` function allows you to flip, or reverse, the contents of
-an array along an axis. When using ``np.flip``, specify the array you would like
+an array along an axis. When using ``np.flip()``, specify the array you would like
to reverse and the axis. If you don't specify the axis, NumPy will reverse the
contents along all of the axes of your input array.