How to check whether a pandas DataFrame is empty? In my case I want to print some message in terminal if the DataFrame is empty.
DataFrame
You can use the attribute df.empty to check whether it's empty or not:
df.empty
if df.empty: print('DataFrame is empty!')
Source: Pandas Documentation
1.4m articles
1.4m replys
5 comments
57.0k users