How to ignore NaN? when DataFrame formats data

df is a dataframe , in which there are some NaN values in df . The following code formats each column in turn (for example, changing money into a string that begins with a dollar sign, and the corresponding function is formatter_function ). How to ignore the nan value and not deal with it?

for col in df.columns:
    df[col] = formatter_function(df[col])
return df
Mar.24,2021

it is recommended that your formatter_function be modified to ignore NaN , thus simplifying the code

.
return df.apply(formatter_function) 

otherwise you can do this

return df.apply(lambda c: c[~np.isnan(c)].apply(formatter_function))
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e43d6c-44a66.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e43d6c-44a66.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?