我想知道是否有一种方法可以用1s填充非0的python DataFrame值。我想没有for循环。在图片中,您无法看到DataFrame的外观]
谢谢!
DataFrame Picture
也许尝试:
df=df.ne(0).astype(int)