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
Auf dieser Seite können Sie das Online-Video Check if pandas DataFrame is Empty in Python (Examples) | Zero Rows & Columns | Logical Indicator mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Statistics Globe 30 November 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 348 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!