Using Python3.7 and the currently most updated version of Pandas.
I have a dataframe with the following datatypes: [category, float, object(text)]
all i want to do is fill NaN values for the entire dataframe at once.
What ive been doing on my own is going one-by-one through every single column (hundreds at a time) and grouping columnnames into lists organized by datatype. Then setting that list of columns with pd.astype(datatype)
. this was extremely tedious and inefficient, as i still continue to get back lots of errors. Ive been doing it this way for months, but now i have excel sheets with arbitrary data to read in, and considering the size of the dataframes im beginning to work with (+/-400k) its unrealistic to continue that way.
For the dtypes "category" and "object(text)", i want to fillna with the string 'empty'. And for float dtypes, i want to fillna with 0.0. At this point in my project, I am not yet interested in filling with mean/median values.
Ideally I would like to achieve this with something simple like:
df.fillna_all({'float':0, 'category':'empty', 'object':'empty'})
please help!