pandas - 在python中根据字符串值创建单独的列
问题描述
我很新,但我正在使用如下所示的数据框:
ID Tag
123 Asset Class > Equity
123 Inquiry Type > Demonstration
123 Inquiry Topic > Holdings
456 Asset Class > Fixed Income
456 Inquiry Type > BF
456 Inquiry Topic > VaR
我想要做的是将其更改为如下所示的数据框:
ID Asset Type Inquiry Type Inquiry Topic
123 Equity Demonstration Holdings
456 Fixed Income Bf VaR
对不起,如果这很简单;但是,我对这种操作有疑问。我试过 .melt 但这似乎并没有完成我想要完成的事情。
解决方案
推荐阅读
- javascript - 如何使用客户端事件 API 在 elFinder 中记录已删除的文件名?
- python - 尝试使用小数包设置精度但无法获得所需的精度
- spring-boot - 如何在 webflux 中抛出异常或处理过滤条件?
- python - 使用 pandas dateoffset 并向前推进 num_years(由列给出)
- r - 如何将同名(STATE)的行转换为R中的列
- c++ - 在向量上使用 push_back()
> - docker - exec-maven-plugin - 将目录从 docker 容器复制到主机
- sql - SQL将时差转换为int
- r - 如何从单列的 2 个表创建 2 个列的表
- sql - 使用 join 按 id 映射用户