-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Raise TypeError only if key DataFrame is not empty #10126 #10196
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
BUG: Raise TypeError only if key DataFrame is not empty #10126 #10196
Conversation
change this to close issue #10126 instead |
@@ -794,6 +794,24 @@ def test_setitem_empty(self): | |||
result.loc[result.b.isnull(), 'a'] = result.a | |||
assert_frame_equal(result, df) | |||
|
|||
def test_setitem_empty_frame_with_boolean(self): | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue number here as a comment
ba7b437
to
a0ce8ed
Compare
df = pd.DataFrame([[2, 2]], index=pd.DatetimeIndex(['2011-01-01'])) | ||
df2 = pd.DataFrame([[1, 1]], index=pd.DatetimeIndex(['2011-01-01'])) | ||
|
||
df[df > df2] = 47 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need the first part of this test (e.g. before the loop), its just confusing.
Using ======================================================================
FAIL: test_setitem_boolean (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\dev\code\opensource\pandas-rekcahpassyla\pandas\tests\test_frame.py", line 621, in test_setitem_boolean
df[df * 0] = 2
File "c:\dev\code\opensource\pandas-rekcahpassyla\pandas\util\testing.py", line 1640, in __exit__
raise AssertionError("{0} not raised.".format(name))
AssertionError: TypeError not raised.
======================================================================
FAIL: test_frame_getitem_setitem_boolean (pandas.tests.test_multilevel.TestMultiLevel)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\dev\code\opensource\pandas-rekcahpassyla\pandas\tests\test_multilevel.py", line 354, in test_frame_getitem_setitem_boolean
df[df * 0] = 2
File "c:\dev\code\opensource\pandas-rekcahpassyla\pandas\util\testing.py", line 1640, in __exit__
raise AssertionError("{0} not raised.".format(name))
AssertionError: TypeError not raised. |
b8b3e4c
to
dcda77e
Compare
Fixed my obvious silly mistake. (Doh) |
]: | ||
df2 = df.copy() | ||
df[df > df2] = 47 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you still need an assert_frame_equal
here to make that the assignment is correct.
c2cb4da
to
c5d99b7
Compare
ok, looks good. pls add a release mentioning the original issue. |
c5d99b7
to
f8e7c93
Compare
Rebased and added release note to 0.16.2, in the bug fix section. |
…oolean BUG: Raise TypeError only if key DataFrame is not empty #10126
thanks! |
Thank you! |
Since this is merged in master, all travis builds seem to fail (although the tests for the PR itself were green):
|
Ah, caused by bottleneck upgrade: #10270 |
Proposed fix for #10126