def isnan(x):
    if isinstance(x, (int, float, complex)) and math.isnan(x):
        return True
df.apply(lambda x: x.apply(lambda x: [] if isnan(x) else x))
How to fill dataframe Nan values with empty list [] in pandas?