python - Replacing missing data in pandas.DataFrame not working -
I'm digging in it
I have a panda. Detafrem which column 'age in' I am trying to change the I'm doing with them were alone: And the same way for those who were not alone: But it is not working at all, Column Any thoughts on this? The problem is that the values were changed on the copy of the original frame in the view document details: when a Pands set value in the object, then chained indexing is said to be taking care to avoid needed. To change the values on the View the original frame you can: scattered NaN ' value and the second column
IsAlone has been created with value
1 or
0 on the basis of a private rule on the basis of that person was alone on that ship.
NaN values on the columns
age for those people who were alone and the average age of those people with the aim in the same manner which was not alone based on just a rule
NaN instead of values to practice Pands Detafrem
df_train [(df_train.IsAlone.astype (bool) and df_train.Age.isnull ())] .ge = \ df_train [(df_train.IsAlone.astype (bool) & Amp; ~ df_train.Age.isnull ())]. Age Mean ()
df_train [(~ df_train.IsAlone.astype (bool) and df_train .ge.isnull ())]. Age = \ df_train [(~ df_train.IsAlone .sleeppe (bool) and ~ df_train.Age.isnull ())]. Age Pisces ()
Age still has the same
NaN value.
j = df_train.IsAlone. Astype (bool) & amp; Df_train.Age.isnull () I = df_train.IsAlone.astype (bool) & amp; ~ Df_train.Age.isnull () df_train.loc [j, 'age'] = df_train.loc [i, 'age']. Meaning ()
Comments
Post a Comment