I would like to know if there is a way to fill python DataFrame values that are not 0s with 1s. I would like to do it without a for loop. In the picture you cann see what the DataFrame looks like
Thanks!!!
Try maybe:
df=df.ne(0).astype(int)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.