-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
using DataFrame.resample with 'agg' method on non-existant columns provides unexpected behavior #19552
Conversation
@@ -659,6 +659,21 @@ def f(): | |||
'B': {'rb': ['mean', 'std']}}) | |||
assert_frame_equal(result, expected, check_like=True) | |||
|
|||
def test_try_aggregate_non_existing_column(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.
I'm not sure that this test is needed because test_agg_misc
test covers this case. I added it to show reviewer that original issue is addressed. Let me know and I'll remove this new test.
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.
Good to keep it.
Looks like your change is causing failures elsewhere. I'm not personally familiar with this code, I'm not sure what the best way forward is. Let me know if you need help though, and I can take a look. |
doc/source/whatsnew/v0.23.0.txt
Outdated
@@ -646,6 +646,7 @@ Groupby/Resample/Rolling | |||
- Bug in :func:`DataFrame.groupby` where tuples were interpreted as lists of keys rather than as keys (:issue:`17979`, :issue:`18249`) | |||
- Bug in :func:`DataFrame.transform` where particular aggregation functions were being incorrectly cast to match the dtype(s) of the grouped data (:issue:`19200`) | |||
- Bug in :func:`DataFrame.groupby` passing the `on=` kwarg, and subsequently using ``.apply()`` (:issue:`17813`) | |||
- Bug in :func:`DataFrame.aggregate` on non-existant columns (:issue:`16766`) |
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.
Say what the issue was, also I think the issue was with DataFrame.resample().aggregate
, not DataFrame.aggregate
, right?
So something like
Bug in :func:`DataFrame.resample` not raising a a `KeyError` when aggregating a non-existent column.
@@ -659,6 +659,21 @@ def f(): | |||
'B': {'rb': ['mean', 'std']}}) | |||
assert_frame_equal(result, expected, check_like=True) | |||
|
|||
def test_try_aggregate_non_existing_column(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.
Good to keep it.
Hello @discort! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on February 07, 2018 at 08:24 Hours UTC |
0d1ebe4
to
72f328e
Compare
Codecov Report
@@ Coverage Diff @@
## master #19552 +/- ##
==========================================
+ Coverage 91.6% 91.6% +<.01%
==========================================
Files 150 150
Lines 48750 48752 +2
==========================================
+ Hits 44656 44660 +4
+ Misses 4094 4092 -2
Continue to review full report at Codecov.
|
thanks! keep em coming! |
@@ -392,6 +392,10 @@ def nested_renaming_depr(level=4): | |||
|
|||
elif isinstance(obj, ABCSeries): | |||
nested_renaming_depr() | |||
elif isinstance(obj, ABCDataFrame) and \ | |||
k not in obj.columns: | |||
raise ValueError( |
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.
actuallly I think this should be a KeyError. can you do another PR to fix?
git diff upstream/master -u -- "*.py" | flake8 --diff