-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Labels
Numeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Milestone
Description
This came up while going through some of statsmodels tests:
arr = np.random.randn(3, 2)
arr[:, 0] = [1, 2, 3]
df = pd.DataFrame(arr)
df[0] = df[0].astype(int)
>>> df == arr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pandas/core/ops.py", line 1572, in f
try_cast=False)
File "pandas/core/frame.py", line 4021, in _combine_const
try_cast=try_cast)
File "pandas/core/internals.py", line 3644, in eval
return self.apply('eval', **kwargs)
File "pandas/core/internals.py", line 3538, in apply
applied = getattr(b, f)(**kwargs)
File "pandas/core/internals.py", line 1348, in eval
t_shape=values.T.shape, oth_shape=other.shape))
ValueError: cannot broadcast shape [(3, 1)] with block values [(3, 2)]
I'd expect this to wrap the ndarray in a frame and return an all-True frame.
Metadata
Metadata
Assignees
Labels
Numeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode