vla*_*lad 2 python dataframe pandas
我有 2 个数据框熊猫 df1、df2:
df1 = pd.DataFrame({'col1': ['A', 'B', 'C', 'D'],
'col2': ["D1","D2","D3","D4"],
'col3': ["C1","C2","C3","C4"],
'col4': ["B1","B2","B3","B4"]})
df2 = pd.DataFrame({'col_ID': ['A', 'D']})
df1=
col1 | col2 | col3 | col4
A | D1 | C1 | B1
B | D2 | C2 | B2
C | D3 | C3 | B3
D | D4 | C4 | B4
Run Code Online (Sandbox Code Playgroud)
和 df2 :
df2=
col_ID |
A |
D |
Run Code Online (Sandbox Code Playgroud)
我想拥有 df1.col1 中不存在于 df2.col_ID 中的行
df1=
col1 | col2 | col3 | col4
B | D2 | C2 | B2
C | D3 | C3 | B3
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助
| 归档时间: |
|
| 查看次数: |
43 次 |
| 最近记录: |