我有firstDF:
rs Chr MapInfo Name SourceSeq
1 A1 B1 C1 D1
2 A2 B2 C2 D2
3 A3 B3 C3 D3
4 A4 B4 C4 D4
5 A5 B5 C5 D5
和secondDF:
Chr MapInfo Name SourceSeq Unnamed: 0 rs
1 A1 B1 C1 D1 E1
4 A4 B4 C4 D4 E4
8 A8 B8 C8 D8 E8
10 A10 B10 C10 D10 E10
我需要创建一个新的数据帧,它只包含secondDF中的行,而在first中不存在:
新数据框:
Chr MapInfo Name SourceSeq Unnamed: 0 rs
8 A8 B8 C8 D8 E8
10 A10 B10 C10 D10 E10
我想用Name
过滤它。有什么更好的办法
我对fullouter
合并很感兴趣,但col是不同的,老实说,我不知道如何正确地进行合并
第二,我认为这是一个循环,但它没有效率
上一次我试着这样做:
new= secondDF[~firstDF.Name.isin(secondDF.name)]
但我得到了:
IndexingError: Unalignable boolean Series provided as indexer (index of the boolean Series and of the indexed object do not match
有人能给我关于那项任务的建议吗
解决方案是更改掩码-从
firstDF
逐列比较secondDF.Name
,从示例数据它是MapInfo
列,在实际数据中,布尔掩码的Name
列的大小和索引值与secondDF
相同,因为是经过筛选的secondDF
数据帧:相关问题 更多 >
编程相关推荐