8000 DOC: Adjust constants.rst · numpy/numpy@39e813b · GitHub
[go: up one dir, main page]

Skip to content

Commit 39e813b

Browse files
committed
DOC: Adjust constants.rst
1 parent 7a98ba4 commit 39e813b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

doc/source/reference/constants.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,41 +108,41 @@ NumPy includes several constants:
108108

109109
.. rubric:: Examples
110110

111-
>>> newaxis is None
111+
>>> np.newaxis is None
112112
True
113113
>>> x = np.arange(3)
114114
>>> x
115115
array([0, 1, 2])
116-
>>> x[:, newaxis]
116+
>>> x[:, np.newaxis]
117117
array([[0],
118118
[1],
119119
[2]])
120-
>>> x[:, newaxis, newaxis]
120+
>>> x[:, np.newaxis, np.newaxis]
121121
array([[[0]],
122122
[[1]],
123123
[[2]]])
124-
>>> x[:, newaxis] * x
124+
>>> x[:, np.newaxis] * x
125125
array([[0, 0, 0],
126126
[0, 1, 2],
127127
[0, 2, 4]])
128128

129129
Outer product, same as ``outer(x, y)``:
130130

131131
>>> y = np.arange(3, 6)
132-
>>> x[:, newaxis] * y
132+
>>> x[:, np.newaxis] * y
133133
array([[ 0, 0, 0],
134134
[ 3, 4, 5],
135135
[ 6, 8, 10]])
136136

137-
``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``:
137+
``x[np.newaxis, :]`` is equivalent to ``x[np.newaxis]`` and ``x[None]``:
138138

139-
>>> x[newaxis, :].shape
139+
>>> x[np.newaxis, :].shape
140140
(1, 3)
141-
>>> x[newaxis].shape
141+
>>> x[np.newaxis].shape
142142
(1, 3)
143143
>>> x[None].shape
144144
(1, 3)
145-
>>> x[:, newaxis].shape
145+
>>> x[:, np.newaxis].shape
146146
(3, 1)
147147

148148

0 commit comments

Comments
 (0)
0