@@ -208,9 +208,9 @@ Computing sums
208208
209209 >>> x = np.array([1 , 2 , 3 , 4 ])
210210 >>> np.sum(x)
211- 10
211+ np.int64(10)
212212 >>> x.sum()
213- 10
213+ np.int64(10)
214214
215215.. image :: images/reductions.png
216216 :align: right
@@ -226,11 +226,11 @@ Sum by rows and by columns:
226226 >>> x.sum(axis = 0 ) # columns (first dimension)
227227 array([3, 3])
228228 >>> x[:, 0 ].sum(), x[:, 1 ].sum()
229- (3, 3 )
229+ (np.int64(3), np.int64(3) )
230230 >>> x.sum(axis = 1 ) # rows (second dimension)
231231 array([2, 4])
232232 >>> x[0 , :].sum(), x[1 , :].sum()
233- (2, 4 )
233+ (np.int64(2), np.int64(4) )
234234
235235.. tip ::
236236
@@ -241,9 +241,9 @@ Sum by rows and by columns:
241241 >>> rng = np.random.default_rng(27446968 )
242242 >>> x = rng.random((2 , 2 , 2 ))
243243 >>> x.sum(axis = 2 )[0 , 1 ]
244- 0.73415...
244+ np.float64( 0.73415...)
245245 >>> x[0 , 1 , :].sum()
246- 0.73415...
246+ np.float64( 0.73415...)
247247
248248Other reductions
249249................
@@ -256,23 +256,23 @@ Other reductions
256256
257257 >>> x = np.array([1 , 3 , 2 ])
258258 >>> x.min()
259- 1
259+ np.int64(1)
260260 >>> x.max()
261- 3
261+ np.int64(3)
262262
263263 >>> x.argmin() # index of minimum
264- 0
264+ np.int64(0)
265265 >>> x.argmax() # index of maximum
266- 1
266+ np.int64(1)
267267
268268**Logical operations: **
269269
270270.. sourcecode :: pycon
271271
272272 >>> np.all([True , True , False ])
273- False
273+ np.False_
274274 >>> np.any([True , True , False ])
275- True
275+ np.True_
276276
277277.. note ::
278278
@@ -282,15 +282,15 @@ Other reductions
282282
283283 >>> a = np.zeros((100 , 100 ))
284284 >>> np.any(a != 0 )
285- False
285+ np.False_
286286 >>> np.all(a == a)
287- True
287+ np.True_
288288
289289 >>> a = np.array([1 , 2 , 3 , 2 ])
290290 >>> b = np.array([2 , 2 , 3 , 2 ])
291291 >>> c = np.array([6 , 4 , 4 , 5 ])
292292 >>> ((a <= b) & (b <= c)).all()
293- True
293+ np.True_
294294
295295**Statistics: **
296296
@@ -299,14 +299,14 @@ Other reductions
299299 >>> x = np.array([1 , 2 , 3 , 1 ])
300300 >>> y = np.array([[1 , 2 , 3 ], [5 , 6 , 1 ]])
301301 >>> x.mean()
302- 1.75
302+ np.float64( 1.75)
303303 >>> np.median(x)
304- 1.5
304+ np.float64( 1.5)
305305 >>> np.median(y, axis = - 1 ) # last axis
306306 array([2., 5.])
307307
308308 >>> x.std() # full population standard dev.
309- 0.82915619758884995
309+ np.float64( 0.82915619758884995)
310310
311311
312312... and many more (best to learn as you go).
@@ -709,20 +709,20 @@ Dimension shuffling
709709 >>> a.shape
710710 (4, 3, 2)
711711 >>> a[0 , 2 , 1 ]
712- 5
712+ np.int64(5)
713713 >>> b = a.transpose(1 , 2 , 0 )
714714 >>> b.shape
715715 (3, 2, 4)
716716 >>> b[2 , 1 , 0 ]
717- 5
717+ np.int64(5)
718718
719719Also creates a view:
720720
721721.. sourcecode :: pycon
722722
723723 >>> b[2 , 1 , 0 ] = - 1
724724 >>> a[0 , 2 , 1 ]
725- -1
725+ np.int64(-1)
726726
727727Resizing
728728........
@@ -817,7 +817,7 @@ Finding minima and maxima:
817817 >>> j_max = np.argmax(a)
818818 >>> j_min = np.argmin(a)
819819 >>> j_max, j_min
820- (0, 2 )
820+ (np.int64(0), np.int64(2) )
821821
822822
823823.. XXX: need a frame for summaries
0 commit comments