Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.

Examples
An example of an actual empty DataFrame where the index is empty:

In [1]:
import numpy as np
import pandas as pd
In [2]:
df_empty = pd.DataFrame({'P' : []})
df_empty
Out[2]:
P
In [3]:
df_empty.empty
Out[3]:
True

If we only have NaNs in our DataFrame, it is not considered empty! We will need to drop
the NaNs to make the DataFrame empty:

In [4]:
df = pd.DataFrame({'P' : [np.nan]})
df
Out[4]:
P
0 NaN
In [5]:
df.empty
Out[5]:
False
In [6]:
df.dropna().empty
Out[6]:
True