【发布时间】:2020-05-25 06:29:36
【问题描述】:
我试图用 1 替换所有大于 1 的数字,同时以最小的努力在整个数据框中保持原始 1 和 0 不变。感谢任何支持!
我的数据框看起来像这样,但包含更多的列和行。
Report No Apple Orange Lemon Grape Pear
One 5 0 2 1 1
Two 1 1 0 3 2
Three 0 0 2 1 3
Four 1 1 3 0 0
Five 4 0 0 1 1
Six 1 3 1 2 0
期望的输出:
Report No Apple Orange Lemon Grape Pear
One 1 0 1 1 1
Two 1 1 0 1 1
Three 0 0 1 1 1
Four 1 1 1 0 0
Five 1 0 0 1 1
Six 1 1 1 1 0
【问题讨论】: