excel - 如何在Excel中两列的唯一值之间制作1,0映射文件?
问题描述
嗨,我有一张如下表:
Ortho Path
L20795 ABbiosynthesis
L43787 ABbiosynthesis
L43789 ABbiosynthesis
L20795 CDbiosynthesis
L43787 CDbiosynthesis
L20632 CDbiosynthesis
L43789 CDbiosynthesis
L20074 XYZpentaABC
L20232 XYZpentaABC
L20508 XYZpentaABC
L20626 XYZpentaABC
L20632 XYZpentaABC
L21692 XYZpentaABC
L21715 XYZpentaABC
L21782 XYZpentaABC
L21825 XYZpentaABC
L25605 XYZpentaABC
L27823 XYZpentaABC
L43767 XYZpentaABC
L45016 XYZpentaABC
L43821 ABCDEFbiosynthesis
L20632 ABCDEFbiosynthesis
L20019 MNOPbiosynthesis
L20059 MNOPbiosynthesis
L20065 MNOPbiosynthesis
L20208 MNOPbiosynthesis
L20209 MNOPbiosynthesis
L20647 MNOPbiosynthesis
L21716 MNOPbiosynthesis
L22371 MNOPbiosynthesis
L22372 MNOPbiosynthesis
L27535 MNOPbiosynthesis
L41610 MNOPbiosynthesis
L46363 MNOPbiosynthesis
L48474 MNOPbiosynthesis
我想在表的第一列和第二列的唯一元素之间进行 0,1 映射。第二列的唯一值将是输出文件中的列名,第一列中的唯一名称将是行名。如果第一列中的唯一值(例如 L48474 和 MNOPbiosynthesis)与第二列中的一个唯一值相关联,则它们的对应值为 1,如果没有关联(L20232 和 MNOPbiosynthesis),则它们的对应值为0. 我期待如下输出:
ABbiosynthesis CDbiosynthesis XYZpentaABC ABCDEFbiosynthesis MNOPbiosynthesis
L20795 1 1 0 0 1
L43787 1 1 0 0 0
L43789 1 1 0 1 0
L20795 1 1 0 0 0
L43787 1 1 0 0 1
L20632 0 1 1 1 0
L43789 1 1 0 0 0
L20074 0 0 1 0 0
L20232 0 0 1 0 1
谁能告诉我该怎么做?
非常感谢
解决方案
推荐阅读
- reactjs - 如何在渲染之前将发送数据发送到组件?
- python - Pytorch 问题:关闭并重新打开 Spyder IDE 后,torch.load() 无法从文件中正确加载保存的模型
- regex - 正则表达式:匹配包含特殊字符的单词
- python - python中的CSV文件 - 如何附加到一行中的某个元素
- azure - 从 Node.js 应用程序执行 cosmos 存储过程给出未定义的响应
- r - 解析字符串/ISO 8601 日期
- next.js - next.js 使用 [...id].js 的静态嵌套路由内容(目录)出错
- c++ - 如何在 C++ 包扩展中包含多行或语句?
- java-8 - 从 Java 8 中的 Map 过滤并返回值
- java - Javers Set Changes - 仅检测对象是否被添加或删除,而不是更改