How to test whether a pandas DataFrame is empty in the Python programming language. More details: https://statisticsglobe.com/check-if-...
Python code of this video:
import pandas as pd # Load pandas library
data1 = pd.DataFrame({'x1':[6, 7, 3, 7, 9], # Create example DataFrame
'x2':[3, 6, 4, 1, 3],
'x3':range(6, 1, - 1)})
print(data1) # Print example DataFrame
print(data1.empty) # Test if DataFrame is empty
False
data2 = pd.DataFrame() # Create empty DataFrame
print(data2) # Print empty DataFrame
Empty DataFrame
Columns: []
Index: []
print(data2.empty) # Test if DataFrame is empty
True
Follow me on Social Media:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – R Programming Group for Discussions & Questions: / statisticsglobe
Facebook – Python Programming Group for Discussions & Questions: / statisticsglobepython
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – R Programming Group for Discussions & Questions: / 12555223
LinkedIn – Python Programming Group for Discussions & Questions: / 12673534
Twitter: / joachimschork
Music by bensound.com
Watch video Check if pandas DataFrame is Empty in Python (Examples) | Zero Rows & Columns | Logical Indicator online, duration hours minute second in high quality that is uploaded to the channel Statistics Globe 30 November 2022. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 348 times and liked it 5 visitors.