Python numpy.core.numeric.sort() Examples
The following are 3
code examples of numpy.core.numeric.sort().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.core.numeric
, or try the search function
.
Example #1
Source File: ma.py From Computable with MIT License | 6 votes |
def sort (x, axis = -1, fill_value=None): """If x does not have a mask, return a masked array formed from the result of numeric.sort(x, axis). Otherwise, fill x with fill_value. Sort it. Set a mask where the result is equal to fill_value. Note that this may have unintended consequences if the data contains the fill value at a non-masked site. If fill_value is not given the default fill value for x's type will be used. """ if fill_value is None: fill_value = default_fill_value (x) d = filled(x, fill_value) s = fromnumeric.sort(d, axis) if getmask(x) is nomask: return masked_array(s) return masked_values(s, fill_value, copy=0)
Example #2
Source File: ma.py From Computable with MIT License | 5 votes |
def argsort (x, axis = -1, out=None, fill_value=None): """Treating masked values as if they have the value fill_value, return sort indices for sorting along given axis. if fill_value is None, use get_fill_value(x) Returns a numpy array. """ d = filled(x, fill_value) return fromnumeric.argsort(d, axis)
Example #3
Source File: ma.py From Computable with MIT License | 5 votes |
def argmax (x, axis = -1, out=None, fill_value=None): """Treating masked values as if they have the value fill_value, return sort indices for maximum along given axis. if fill_value is None, use -get_fill_value(x) if it exists. Returns a numpy array if x has more than one dimension. Otherwise, returns a scalar index. """ if fill_value is None: fill_value = default_fill_value (x) try: fill_value = - fill_value except: pass d = filled(x, fill_value) return fromnumeric.argmax(d, axis)