-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DataFrame.dropna bug fix #8366
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
DataFrame.dropna bug fix #8366
Conversation
need a test for this |
…columns in subset arg
@@ -2552,7 +2552,11 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None, | |||
agg_obj = self | |||
if subset is not None: | |||
ax = self._get_axis(agg_axis) | |||
agg_obj = self.take(ax.get_indexer_for(subset),axis=agg_axis) | |||
indices = ax.get_indexer_for(subset) | |||
if -1 in indices : |
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.
do something more like this (keeping with pandas coding style and more efficient)
indexer = ax.get_indexer_for(subset)
check = indexer == -1
if check.any():
raise KeyError(subset[check])
agg_object = self.take(indicies,axis=agg_axis
pls add a release note in v0.15.0 Bug Fix section as well (and squash when you are done). ping when green. Git references are here: https://github.com/pydata/pandas/wiki/Using-Git |
I added the release note and changed the fix to use the more natural pandas/numpy syntax. I submitted a new pull request with all of this in one commit. (I did something bad to my 8303 branch when I tried to rebase and I couldn't push from it - Hopefully I get the hang of rebasing soon.) On Sep 23, 2014, at 7:23 AM, jreback [email protected] wrote:
|
Bug fix for #8303. Now raise KeyError if any non-existent columns are passed in the subset argument.