-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: raise when doing arithmetic on DataFrame and list of iterables #37132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
96e92b0
79e98cd
7a0e20c
0b461b1
309b3db
bb67158
e7561da
a464f67
0acac06
26d6aba
50fc0ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1577,3 +1577,17 @@ def test_arith_reindex_with_duplicates(): | |
result = df1 + df2 | ||
expected = pd.DataFrame([[np.nan, 0, 0]], columns=["first", "second", "second"]) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
|
||
@pytest.mark.parametrize("arg1", [pd.DataFrame({"x": [1, 2], "y": [1, 2]})]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if there's just one of these (and i think there only needs to be one), then just put it in the test function instead of parameter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for spotting this! Moved the DataFrame inside the test. |
||
@pytest.mark.parametrize( | ||
"arg2", [[pd.Series([1, 1])], [pd.Series([1, 1]), pd.Series([1, 1])]] | ||
) | ||
def test_arith_list_of_arraylike_raise(arg1, arg2): | ||
# GH 36702. Raise when trying to add list of array-like to DataFrame | ||
|
||
msg = f"Unable to coerce list of {type(arg2[0])} to Series/DataFrame" | ||
with pytest.raises(ValueError, match=msg): | ||
arg1 + arg2 | ||
with pytest.raises(ValueError, match=msg): | ||
jreback marked this conversation as resolved.
Show resolved
Hide resolved
|
||
arg2 + arg1 |
Uh oh!
There was an error while loading. Please reload this page.