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)
| 297 | |
| 298 | |
| 299 | def minimum_fill_value(obj): |
| 300 | """ |
| 301 | Return the maximum value that can be represented by the dtype of an object. |
| 302 | |
| 303 | This function is useful for calculating a fill value suitable for |
| 304 | taking the minimum of an array with a given dtype. |
| 305 | |
| 306 | Parameters |
| 307 | ---------- |
| 308 | obj : ndarray, dtype or scalar |
| 309 | An object that can be queried for it's numeric type. |
| 310 | |
| 311 | Returns |
| 312 | ------- |
| 313 | val : scalar |
| 314 | The maximum representable value. |
| 315 | |
| 316 | Raises |
| 317 | ------ |
| 318 | TypeError |
| 319 | If `obj` isn't a suitable numeric type. |
| 320 | |
| 321 | See Also |
| 322 | -------- |
| 323 | maximum_fill_value : The inverse function. |
| 324 | set_fill_value : Set the filling value of a masked array. |
| 325 | MaskedArray.fill_value : Return current fill value. |
| 326 | |
| 327 | Examples |
| 328 | -------- |
| 329 | >>> import numpy.ma as ma |
| 330 | >>> a = np.int8() |
| 331 | >>> ma.minimum_fill_value(a) |
| 332 | 127 |
| 333 | >>> a = np.int32() |
| 334 | >>> ma.minimum_fill_value(a) |
| 335 | 2147483647 |
| 336 | |
| 337 | An array of numeric data can also be passed. |
| 338 | |
| 339 | >>> a = np.array([1, 2, 3], dtype=np.int8) |
| 340 | >>> ma.minimum_fill_value(a) |
| 341 | 127 |
| 342 | >>> a = np.array([1, 2, 3], dtype=np.float32) |
| 343 | >>> ma.minimum_fill_value(a) |
| 344 | inf |
| 345 | |
| 346 | """ |
| 347 | return _extremum_fill_value(obj, min_filler, "minimum") |
| 348 | |
| 349 | |
| 350 | def maximum_fill_value(obj): |