MCPcopy Create free account
hub / github.com/numpy/numpy / maximum_fill_value

Function maximum_fill_value

numpy/ma/core.py:350–398  ·  view source on GitHub ↗

Return the minimum value that can be represented by the dtype of an object. This function is useful for calculating a fill value suitable for taking the maximum of an array with a given dtype. Parameters ---------- obj : ndarray, dtype or scalar An object that can

(obj)

Source from the content-addressed store, hash-verified

348
349
350def maximum_fill_value(obj):
351 """
352 Return the minimum value that can be represented by the dtype of an object.
353
354 This function is useful for calculating a fill value suitable for
355 taking the maximum of an array with a given dtype.
356
357 Parameters
358 ----------
359 obj : ndarray, dtype or scalar
360 An object that can be queried for it's numeric type.
361
362 Returns
363 -------
364 val : scalar
365 The minimum representable value.
366
367 Raises
368 ------
369 TypeError
370 If `obj` isn't a suitable numeric type.
371
372 See Also
373 --------
374 minimum_fill_value : The inverse function.
375 set_fill_value : Set the filling value of a masked array.
376 MaskedArray.fill_value : Return current fill value.
377
378 Examples
379 --------
380 >>> import numpy.ma as ma
381 >>> a = np.int8()
382 >>> ma.maximum_fill_value(a)
383 -128
384 >>> a = np.int32()
385 >>> ma.maximum_fill_value(a)
386 -2147483648
387
388 An array of numeric data can also be passed.
389
390 >>> a = np.array([1, 2, 3], dtype=np.int8)
391 >>> ma.maximum_fill_value(a)
392 -128
393 >>> a = np.array([1, 2, 3], dtype=np.float32)
394 >>> ma.maximum_fill_value(a)
395 -inf
396
397 """
398 return _extremum_fill_value(obj, max_filler, "maximum")
399
400
401def _recursive_set_fill_value(fillvalue, dt):

Callers 5

argsortMethod · 0.85
argmaxMethod · 0.85
maxMethod · 0.85

Calls 1

_extremum_fill_valueFunction · 0.85

Tested by 2