I have an if statement where it checks if the data frame is not empty. The way I do it is the following:
if
if dataframe.empty: pass else: #do
Just do
if not dataframe.empty: # insert code here
The reason this works is because dataframe.empty returns True if dataframe is empty. To invert this, we can use the negation operator not, which flips True to False and vice-versa.
dataframe.empty
True
not
False