![如何在多列中找到特定值,然后在另一列中显示找到该特定值的列名](https://linux22.com/image/1630663/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%A4%9A%E5%88%97%E4%B8%AD%E6%89%BE%E5%88%B0%E7%89%B9%E5%AE%9A%E5%80%BC%EF%BC%8C%E7%84%B6%E5%90%8E%E5%9C%A8%E5%8F%A6%E4%B8%80%E5%88%97%E4%B8%AD%E6%98%BE%E7%A4%BA%E6%89%BE%E5%88%B0%E8%AF%A5%E7%89%B9%E5%AE%9A%E5%80%BC%E7%9A%84%E5%88%97%E5%90%8D.png)
我有一个如下所示的数据集:
ID Assignment Sex Age_0_34 Age_35_45
1 MBT F 0% 0%
1 MBT F 0% 0%
2 MBT F 0% 2.5%
2 MBT F 0% 0%
3 MBT F 1.5% 0%
3 MBT F 0% 0%
4 MBT F 0% 0%
4 MBT F 0% 1.2%
我希望最后一列之后的内容是这样的:
ID Assignment Sex Age_0_34 Age_35_45 Age
1 MBT F 2.0% 0% Age_0_34
1 MBT F 0% 5.0% Age_35_45
2 MBT F 0% 2.5% Age_35_45
2 MBT F 0% 0% 0
3 MBT F 1.5% 0% Age_0_34
3 MBT F 0% 0% 0
4 MBT F 3.5% 0% Age_0_34
4 MBT F 0% 1.2% Age_35_45
所以基本上我想做的是创建一个值大于 1% 的列,并在该行旁边的最后一列中显示列名