I have a dataframe that has about 15 numeric columns, and for some reason when I pass those numeric columns as a list into the pd.fillna()
method, 3 of them don't have their values filled, and I'm not sure why this is the case.
MY CODE:
num_cols = df.select_dtypes(include=[np.number]).columns.tolist()
num_cols
then looks like this:
Then I pass num_cols
into the dataframe using the fillna
method, but some of the columns aren't affected by it.
df[num_cols].fillna(df[num_cols].median(), inplace=True)
df[num_cols].isnull().sum()
This last command produces the following picture:
Any idea why this wouldn't be working?
np.float16
, which was not the same as the others. – Jonathan Bechtel Mar 12 '19 at 14:48