I'm trying to create a column in my data set such that any null values can be set to 0, and non-null values are set to 1. For starters, my column of data called '9Age', roughly speaking, looks like this:
NaN
6
5
NaN
2
NaN
3
5
4
Run Code Online (Sandbox Code Playgroud)
Setting null values to 0 can be as easy as doing this:
Age0 = df['9Age'].fillna(0)
Run Code Online (Sandbox Code Playgroud)
However, here's the rest of my attempt: Deciding whether a value is null or not was …