Skip to content
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

dropna able to accept a list/tuple for axis argument #924

Closed
jreback opened this issue Mar 16, 2012 · 1 comment
Closed

dropna able to accept a list/tuple for axis argument #924

jreback opened this issue Mar 16, 2012 · 1 comment
Labels
Enhancement Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Mar 16, 2012

rationale:

I sometimes work with square matricies that potentially could have a column (and row) of all na's

I find myself doing:

df.dropna(how='all',axis=0).dropna(how='all',axis=1)

so

df.dropna(how='all',axis=[0,1])

e.g.

_dropna = DataFrame.dropna
def revised_dropna(self, axis = None, **kwargs):
    if isinstance(axis,(list,tuple)):
        return _dropna(_dropna(self,axis=axis[0],**kwargs),axis=axis[1],**kwargs)
    return _dropna(self,axis=axis,**kwargs)
DataFrame.dropna = revised_dropna
@wesm wesm closed this as completed in fa5f315 Sep 18, 2012
@wesm
Copy link
Member

wesm commented Sep 18, 2012

Great idea. Just pushed the enhancement / unit test

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

No branches or pull requests

2 participants