
Problem –
You have a dataframe and you want to know whether it is empty or not?
Solution –
In pandas, you can use the df.empty attribute to know whether a dataframe is empty or not.
if df.empty:
print("DataFrame is empty!")
else:
print("DataFrame is not empty!")