What is the reason to prefer Pandas implementation of .any() instead of Python's builtin any() when used on a DataFrame? Is there a performance reason to this, since Pandas DataFrames are column-major? My hunch is perhaps the Pandas method is implemented in such a way that it is faster for column-based reads, in expectation. Can anyone confirm?
Why this:
if df.any():
instead of this:
if any(df):
Correct me if I am wrong:
False.any(df)checks the truthiness of the columns themselves, not the individual values within the DataFrame.