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