def min_max(x, na_rm=False, finite=True):
if not hasattr(x, '<STR_LIT>'):<EOL><INDENT>x = np.asarray(x)<EOL><DEDENT>if na_rm and finite:<EOL><INDENT>x = x[np.isfinite(x)]<EOL><DEDENT>elif not na_rm and np.any(np.isnan(x)):<EOL><INDENT>return np.nan, np.nan<EOL><DEDENT>elif na_rm:<EOL><INDENT>x = x[~np.isnan(x)]<EOL><DEDENT>elif finite:<EOL><INDENT>x = x[~np.isinf(x)]<EOL><DEDENT>if (len(x)):<EOL><INDENT>return np.min(x), np.max(x)<EOL><DEDENT>else:<EOL><INDENT>return float('<STR_LIT>'), float('<STR_LIT>')<EOL><DEDENT>
Return the minimum and maximum of x

Parameters
----------
x : array_like
    Sequence
na_rm : bool
    Whether to remove ``nan`` values.
finite : bool
    Whether to consider only finite values.

Returns
-------
out : tuple
    (minimum, maximum) of x