@@ -60,14 +60,12 @@ 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
68
66
inf
69
67
>>> np.array([1 ]) / 0 .
70
- array([ Inf ])
68
+ array([inf ])
71
69
72
70
73
71
.. data :: nan
@@ -97,9 +95,9 @@ NumPy includes several constants:
97
95
>>> np.nan
98
96
nan
99
97
>>> np.log(- 1 )
100
- nan
98
+ np.float64( nan)
101
99
>>> np.log([- 1 , 1 , 2 ])
102
- array([ NaN, 0. , 0.69314718])
100
+ array([ nan, 0. , 0.69314718])
103
101
104
102
105
103
.. data :: newaxis
@@ -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
0 commit comments