Skip to content

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

Closed
wants to merge 3 commits into from
Closed

DataFrame.dropna bug fix #8366

wants to merge 3 commits into from

Conversation

mcjcode
Copy link
Contributor

@mcjcode mcjcode commented Sep 23, 2014

Bug fix for #8303. Now raise KeyError if any non-existent columns are passed in the subset argument.

@jreback
Copy link
Contributor

jreback commented Sep 23, 2014

need a test for this

@@ -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 :
Copy link
Contributor

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

@jreback jreback added Bug Can't Repro Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate and removed Can't Repro labels Sep 23, 2014
@jreback jreback added this to the 0.15.0 milestone Sep 23, 2014
@jreback
Copy link
Contributor

jreback commented Sep 23, 2014

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

@mcjcode mcjcode closed this Sep 25, 2014
@mcjcode mcjcode deleted the 8303 branch September 25, 2014 00:05
@mcjcode
Copy link
Contributor Author

mcjcode commented Sep 25, 2014

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:

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


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants