Closed
Description
0.24.2
In [4]: s = pd.Series([1, 2, 3])
In [5]: o = np.array([0, 1 ,2])
In [6]: np.subtract.outer(s, o)
Out[6]:
array([[ 1, 0, -1],
[ 2, 1, 0],
[ 3, 2, 1]])
master
In [7]: np.subtract.outer(s, o)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-7-a64bc670e48a> in <module>
----> 1 np.subtract.outer(s, o)
~/sandbox/pandas/pandas/core/series.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
793 return None
794 else:
--> 795 return construct_return(result)
796
797 def __array__(self, dtype=None):
~/sandbox/pandas/pandas/core/series.py in construct_return(result)
784 index=index,
785 name=name,
--> 786 copy=False)
787
788 if type(result) is tuple:
~/sandbox/pandas/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
255 else:
256 data = sanitize_array(data, index, dtype, copy,
--> 257 raise_cast_failure=True)
258
259 data = SingleBlockManager(data, index, fastpath=True)
~/sandbox/pandas/pandas/core/internals/construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure)
654 elif subarr.ndim > 1:
655 if isinstance(data, np.ndarray):
--> 656 raise Exception('Data must be 1-dimensional')
657 else:
658 subarr = com.asarray_tuplesafe(data, dtype=dtype)
Exception: Data must be 1-dimensional
Probably not an RC blocker, but I may try to get a fix in quick.
Do we want to return an ndarray here? We don't want a DataFrame where the index & columns match?
cc @jorisvandenbossche @shoyer if you have thoughts on the ideal return type.