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)
| 381 | |
| 382 | |
| 383 | def maximum_fill_value(obj): |
| 384 | """ |
| 385 | Return the minimum value that can be represented by the dtype of an object. |
| 386 | |
| 387 | This function is useful for calculating a fill value suitable for |
| 388 | taking the maximum of an array with a given dtype. |
| 389 | |
| 390 | Parameters |
| 391 | ---------- |
| 392 | obj : ndarray, dtype or scalar |
| 393 | An object that can be queried for it's numeric type. |
| 394 | |
| 395 | Returns |
| 396 | ------- |
| 397 | val : scalar |
| 398 | The minimum representable value. |
| 399 | |
| 400 | Raises |
| 401 | ------ |
| 402 | TypeError |
| 403 | If `obj` isn't a suitable numeric type. |
| 404 | |
| 405 | See Also |
| 406 | -------- |
| 407 | minimum_fill_value : The inverse function. |
| 408 | set_fill_value : Set the filling value of a masked array. |
| 409 | MaskedArray.fill_value : Return current fill value. |
| 410 | |
| 411 | Examples |
| 412 | -------- |
| 413 | >>> import numpy as np |
| 414 | >>> import numpy.ma as ma |
| 415 | >>> a = np.int8() |
| 416 | >>> ma.maximum_fill_value(a) |
| 417 | -128 |
| 418 | >>> a = np.int32() |
| 419 | >>> ma.maximum_fill_value(a) |
| 420 | -2147483648 |
| 421 | |
| 422 | An array of numeric data can also be passed. |
| 423 | |
| 424 | >>> a = np.array([1, 2, 3], dtype=np.int8) |
| 425 | >>> ma.maximum_fill_value(a) |
| 426 | -128 |
| 427 | >>> a = np.array([1, 2, 3], dtype=np.float32) |
| 428 | >>> ma.maximum_fill_value(a) |
| 429 | -inf |
| 430 | |
| 431 | """ |
| 432 | return _extremum_fill_value(obj, max_filler, "maximum") |
| 433 | |
| 434 | |
| 435 | def _recursive_set_fill_value(fillvalue, dt): |
searching dependent graphs…