我有一个充满浮动(正面和负面)和一些NaN的DataFrame.我想用它的符号替换每个浮点数:
if it's NaN -> it remains Nan if positive -> replace with 1 if negative -> replace with -1 if zero -> leave it as 0
有什么建议可以进行大规模的替换?
先感谢您
python pandas
pandas ×1
python ×1