How can I check if all values under col1
satisfy a condition such as > 2
?
import pandas as pd
d = [
{'col1': 3, 'col2': 'wasteful'},
{'col1': 0, 'col2': 'hardly'},
]
df = pd.DataFrame(d)
I could go
if all(col1 > 2 for i, col1, col2 in df.itertuples()):
#do stuff
but is there a more readable, faster and/or has less memory footprint way?