Return the maximum value that can be represented by the dtype of an object. This function is useful for calculating a fill value suitable for taking the minimum of an array with a given dtype. Parameters ---------- obj : ndarray, dtype or scalar An object that can
(obj)
| 329 | |
| 330 | |
| 331 | def minimum_fill_value(obj): |
| 332 | """ |
| 333 | Return the maximum value that can be represented by the dtype of an object. |
| 334 | |
| 335 | This function is useful for calculating a fill value suitable for |
| 336 | taking the minimum of an array with a given dtype. |
| 337 | |
| 338 | Parameters |
| 339 | ---------- |
| 340 | obj : ndarray, dtype or scalar |
| 341 | An object that can be queried for it's numeric type. |
| 342 | |
| 343 | Returns |
| 344 | ------- |
| 345 | val : scalar |
| 346 | The maximum representable value. |
| 347 | |
| 348 | Raises |
| 349 | ------ |
| 350 | TypeError |
| 351 | If `obj` isn't a suitable numeric type. |
| 352 | |
| 353 | See Also |
| 354 | -------- |
| 355 | maximum_fill_value : The inverse function. |
| 356 | set_fill_value : Set the filling value of a masked array. |
| 357 | MaskedArray.fill_value : Return current fill value. |
| 358 | |
| 359 | Examples |
| 360 | -------- |
| 361 | >>> import numpy as np |
| 362 | >>> import numpy.ma as ma |
| 363 | >>> a = np.int8() |
| 364 | >>> ma.minimum_fill_value(a) |
| 365 | 127 |
| 366 | >>> a = np.int32() |
| 367 | >>> ma.minimum_fill_value(a) |
| 368 | 2147483647 |
| 369 | |
| 370 | An array of numeric data can also be passed. |
| 371 | |
| 372 | >>> a = np.array([1, 2, 3], dtype=np.int8) |
| 373 | >>> ma.minimum_fill_value(a) |
| 374 | 127 |
| 375 | >>> a = np.array([1, 2, 3], dtype=np.float32) |
| 376 | >>> ma.minimum_fill_value(a) |
| 377 | inf |
| 378 | |
| 379 | """ |
| 380 | return _extremum_fill_value(obj, min_filler, "minimum") |
| 381 | |
| 382 | |
| 383 | def maximum_fill_value(obj): |
searching dependent graphs…