0935
0
Q:

check for an empty dataframe

import pandas as pd
df = pd.DataFrame(columns=['A','B','C','D','E','F','G'])
3
# Check for an empty dataframe using pandas:
data = {'num': [1,'Nan',3,4,'NaN']}
df = pd.DataFrame(data)

'''
True: the DataFrame is empty
False: the DataFrame contains values
'''

df.empty  
1
df_empty = pd.DataFrame({'A' : []})
df_empty.empty # True
0
df.empty == True
0

New to Communities?

Join the community