Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python replace negative values with 0

In [5]: df.mask(df < 0, 0)
Out[5]: 
   a  b
0  0  0
1  0  2
2  2  1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #replace #negative #values
ADD COMMENT
Topic
Name
4+6 =