l = [1,2,None]
df = pd.DataFrame({"a":l})
When I display df, it gives me:
+---+-----+
| | a |
+---+-----+
| 0 | 1 |
| 1 | 2 |
| 2 | NaN |
+---+-----+
I define the following function to detect None in column a
def helper(x):
if x is None:
return "it is None"
else:
return "it is not None"
When I use df.a.map(lambda x: helper(x)), it gives me:
0 it is not None
1 it is not None
2 it is not None
Name: a, dtype: object
In l, l[2] is None. After I put it into df, None becomes NaN. Then my function helper(x) does not work. Should I change None in the list l or modify helper(x)?