【发布时间】:2020-06-13 18:23:27
【问题描述】:
如果特定行的列在该列中包含 1,我想获取该列的名称。
例如
For Row 1: Blanks,
For Row 2: Manufacturing,
For Row 3: Manufacturing,
For Row 4: Manufacturing,
For Row 5: Social, Finance, Analytics, Advertising,
现在我只能获得完整的行:
primary_sectors = lambda primary_sector: sectors[
sectors["category_list"] == primary_sector
]
请帮我获取上述数据框中列的名称。
我试过这段代码:
primary_sectors("3D").filter(items=["0"])
它给我输出为1,但我需要输出为Manufacturing
【问题讨论】:
-
请分享数据而不是图片stackoverflow.com/questions/20109391/…
标签: python python-3.x pandas machine-learning