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
In questa pagina del sito puoi guardare il video online Check if pandas DataFrame is Empty in Python (Examples) | Zero Rows & Columns | Logical Indicator della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Statistics Globe 30 novembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 348 volte e gli è piaciuto 5 spettatori. Buona visione!