Coding out missing data
I am going to continue with the variables H1WP13 which stands for the question how close do you feel to your father/step father e.t.c . Firstly, my dataset includes the value “8” which stands for the answer “don’t Know” and I want python to ignore these values.
Secondly, I am going to replace with NaN. Nan is how Python specifies missing data.
I repeat the process for the variable H1WP18B, which stands for how many have played a sport with their father in the past 4 weeks. Here I want to ignore the value refused with the code 6.
Coding in valid data, recording variables
If someone answered to the question “How close do you feel to your father”. It is rare to have given a positive answer to the next question “Have you played a sport with your father in the past 4 weeks”.
Secondary variables
I want to find children which in the past 4 weeks have played a sport and have gone shopping with their father.
H1WP18B stands for sport
H1WP18A stands for shopping
And assign the results into the variable H1WP18_both
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου