We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be nice if dataframe instances implemented __nonzero__ so you could test if a dataframe is empty or not as if it were a boolean.
__nonzero__
The text was updated successfully, but these errors were encountered:
This is pretty easy, but trying to rememeber if we there was a reason for not supporting this....
If you would like to do a PR (and see if anything else breaks)
(and prob should do this for Series and for NDFrame)
In [9]: def nonzero(frame): ...: return len(frame) != 0 ...: In [10]: DataFrame.__nonzero__ = DataFrame.__bool__ = nonzero In [11]: print 'non-empty' if df else 'empty' empty
Sorry, something went wrong.
Isn't there a DataFrame.empty property which does exactly this?
DataFrame.empty
@cswegger yep there is, but this is actually a aslight API change
closed by #3696
Successfully merging a pull request may close this issue.
It would be nice if dataframe instances implemented
__nonzero__
so you could test if a dataframe is empty or not as if it were a boolean.The text was updated successfully, but these errors were encountered: