Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

turn False to nan pandas

In [1]: df = DataFrame([[True, True, False],[False, False, True]]).T

In [2]: df
Out[2]:
       0      1
0   True  False
1   True  False
2  False   True

In [3]: df.applymap(lambda x: 1 if x else np.nan)
Out[3]:
    0   1
0   1 NaN
1   1 NaN
2 NaN   1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #turn #False #nan #pandas
ADD COMMENT
Topic
Name
6+5 =