File tree 1 file changed +9
-9
lines changed 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -108,41 +108,41 @@ NumPy includes several constants:
108
108
109
109
.. rubric :: Examples
110
110
111
- >>> newaxis is None
111
+ >>> np. newaxis is None
112
112
True
113
113
>>> x = np.arange(3 )
114
114
>>> x
115
115
array([0, 1, 2])
116
- >>> x[:, newaxis]
116
+ >>> x[:, np. newaxis]
117
117
array([[0],
118
118
[1],
119
119
[2]])
120
- >>> x[:, newaxis, newaxis]
120
+ >>> x[:, np. newaxis, np. newaxis]
121
121
array([[[0]],
122
122
[[1]],
123
123
[[2]]])
124
- >>> x[:, newaxis] * x
124
+ >>> x[:, np. newaxis] * x
125
125
array([[0, 0, 0],
126
126
[0, 1, 2],
127
127
[0, 2, 4]])
128
128
129
129
Outer product, same as ``outer(x, y) ``:
130
130
131
131
>>> y = np.arange(3 , 6 )
132
- >>> x[:, newaxis] * y
132
+ >>> x[:, np. newaxis] * y
133
133
array([[ 0, 0, 0],
134
134
[ 3, 4, 5],
135
135
[ 6, 8, 10]])
136
136
137
- ``x[newaxis, :] `` is equivalent to ``x[newaxis] `` and ``x[None] ``:
137
+ ``x[np. newaxis, :] `` is equivalent to ``x[np. newaxis] `` and ``x[None] ``:
138
138
139
- >>> x[newaxis, :].shape
139
+ >>> x[np. newaxis, :].shape
140
140
(1, 3)
141
- >>> x[newaxis].shape
141
+ >>> x[np. newaxis].shape
142
142
(1, 3)
143
143
>>> x[None ].shape
144
144
(1, 3)
145
- >>> x[:, newaxis].shape
145
+ >>> x[:, np. newaxis].shape
146
146
(3, 1)
147
147
148
148
You can’t perform that action at this time.
0 commit comments