Oct-26-2018, 05:33 PM
#Here is the question:
### Write a function that takes two columns, 'age' and 'pclass', as input and depending on which pclass, if the age is NaN (command: pd.isnull(age) ) it returns age 40, 30 or 25. For example, if input is [NaN, 1], it returns age = 40
This is titanic data set. It has "age" and "pclass" columns. the "age" column has NaNs. I have to write a code so that when age is NaN and pclass is 1 then replace NaN in age with 40. When age is NaN and pclass is 2, then replace Nan in age with 30. When age is NaN and p class is 3, replace NaN with 25 in age.
Thanks,
### Write a function that takes two columns, 'age' and 'pclass', as input and depending on which pclass, if the age is NaN (command: pd.isnull(age) ) it returns age 40, 30 or 25. For example, if input is [NaN, 1], it returns age = 40
This is titanic data set. It has "age" and "pclass" columns. the "age" column has NaNs. I have to write a code so that when age is NaN and pclass is 1 then replace NaN in age with 40. When age is NaN and pclass is 2, then replace Nan in age with 30. When age is NaN and p class is 3, replace NaN with 25 in age.
Thanks,