I am using this data set: Titanic pasengers
I am trying to fill in missing categorical data but the fillna()
with the inplace
option does not do anything:
import pandas as pd
data = pd.read_csv('https://www.openml.org/data/get_csv/16826755/phpMYEkMl')
# replace question marks with np.nan
data = data.replace('?', np.nan)
var_categor = ['sex', 'cabin', 'embarked' ]
data.loc[:, var_categor].fillna("Missing", inplace=True)
I get the same number of nan values:
data[var_categor].isnull().sum()
I get no error messages, no warnings, it just doesnt do anything. Is this normal behavior? Shouldn't it give a warning?