You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [4]: np.__version__
Out[4]: '1.8.0.dev-31a5501'
When given a scalar, the regular version of atleast_1d returns an array:
In [5]: x = np.atleast_1d(1.0)
In [6]: x
Out[6]: array([ 1.])
ma.atleast_1d returns None:
In [7]: x = np.ma.atleast_1d(1.0)
In [8]: print x
None
ma.atleast_1d and several other functions in the ma module are defined using the class _fromnxfunction (defined in numpy/ma/extras.py). In the __call__ method of this class, in the case where len(args) == 1, the code handles the cases where the single argument is an ndarray, a tuple or list. If the single argument is not one of these, the code falls through to the end without returning anything.
The non-masked versions of these accept a scalar, so the masked version should too:
atleast_1d
atleast_2d
atleast_3d
diagflat
The text was updated successfully, but these errors were encountered:
The np.ma.atleast_1d, np.ma.atleast_2d, np.ma.atleast_3d and np.ma.diagflat
function return arrays when given a scalar in the same manner as their non-ma
counterparts. Previously these function would return None.
Additionally, the np.ma vstack, row_stack, hstack, column_stack, dstack, and
hsplit functions now raise an expection when given a scalar argument.
closesnumpy#3367
The np.ma.atleast_1d, np.ma.atleast_2d, np.ma.atleast_3d and np.ma.diagflat
function return arrays when given a scalar in the same manner as their non-ma
counterparts. Previously these function would return None.
Additionally, the np.ma vstack, row_stack, hstack, column_stack, dstack, and
hsplit functions now raise an expection when given a scalar argument.
closesnumpy#3367
The np.ma.atleast_1d, np.ma.atleast_2d, np.ma.atleast_3d and np.ma.diagflat
function return arrays when given a scalar in the same manner as their non-ma
counterparts. Previously these function would return None.
Additionally, the np.ma vstack, row_stack, hstack, column_stack, dstack, and
hsplit functions now raise an expection when given a scalar argument.
closesnumpy#3367
Here's an example, using
ma.atleast_1d
:When given a scalar, the regular version of
atleast_1d
returns an array:ma.atleast_1d
returnsNone
:ma.atleast_1d
and several other functions in thema
module are defined using the class_fromnxfunction
(defined in numpy/ma/extras.py). In the__call__
method of this class, in the case wherelen(args) == 1
, the code handles the cases where the single argument is an ndarray, a tuple or list. If the single argument is not one of these, the code falls through to the end without returning anything.The non-masked versions of these accept a scalar, so the masked version should too:
The text was updated successfully, but these errors were encountered: