0

I have two datasets like this:


df1:

A    B
111  0.1
222  0.1
333  0.1

df2:
A    C
111  0.112
222  0.111

I want to filter df1 where column A only contain elements that showing in df2 column A, expected result:

A    B
111  0.1
222  0.1

I have tried this:

df1[df1['A'] == df2['A']]

Error:
ValueError: Can only compare identically-labeled Series objects

New to Python, can someone gave me some hint, I had a look at other similar questions here but couldn't find a solution.

wawawa
  • 2,835
  • 6
  • 44
  • 105

0 Answers0