Skip to content

Commit f8c608c

Browse files
aprateek29rossbar
andauthored
Add info on transopose to absolute beginners tutorial (numpy#17703)
Adds a blurb about the transpose property of ndarray and updates formatting of some rst inline literals. Co-authored-by: Ross Barnowski <[email protected]>
1 parent 8b15e57 commit f8c608c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

doc/source/user/absolute_beginners.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ To learn more about finding the unique elements in an array, see `unique`.
10901090
Transposing and reshaping a matrix
10911091
----------------------------------
10921092

1093-
*This section covers* ``arr.reshape()``, ``arr.transpose()``, ``arr.T()``
1093+
*This section covers* ``arr.reshape()``, ``arr.transpose()``, ``arr.T``
10941094

10951095
-----
10961096

@@ -1114,7 +1114,7 @@ You simply need to pass in the new dimensions that you want for the matrix. ::
11141114

11151115
.. image:: images/np_reshape.png
11161116

1117-
You can also use ``.transpose`` to reverse or change the axes of an array
1117+
You can also use ``.transpose()`` to reverse or change the axes of an array
11181118
according to the values you specify.
11191119

11201120
If you start with this array::
@@ -1131,19 +1131,26 @@ You can transpose your array with ``arr.transpose()``. ::
11311131
[1, 4],
11321132
[2, 5]])
11331133

1134+
You can also use ``arr.T``::
1135+
1136+
>>> arr.T
1137+
array([[0, 3],
1138+
[1, 4],
1139+
[2, 5]])
1140+
11341141
To learn more about transposing and reshaping arrays, see `transpose` and
11351142
`reshape`.
11361143

11371144

11381145
How to reverse an array
11391146
-----------------------
11401147

1141-
*This section covers* ``np.flip``
1148+
*This section covers* ``np.flip()``
11421149

11431150
-----
11441151

11451152
NumPy's ``np.flip()`` function allows you to flip, or reverse, the contents of
1146-
an array along an axis. When using ``np.flip``, specify the array you would like
1153+
an array along an axis. When using ``np.flip()``, specify the array you would like
11471154
to reverse and the axis. If you don't specify the axis, NumPy will reverse the
11481155
contents along all of the axes of your input array.
11491156

0 commit comments

Comments
 (0)