0

I am new to Python Data Science. Did work in R and exploring Python for ML. I used pass vector in R where condions but I am not sure how I do that in Python.

raw_data1 = {'age1': [23,45,21],'age2': [10,20,50], 'age3':[44,55,77]}
df1 = pd.DataFrame(raw_data1, columns = ['age1','age2','age3'])

raw_data2 = {'age1': [23,45]}
df2 = pd.DataFrame(raw_data2, columns = ['age1'])

Here I like to query df1 based on df2-age1 vector. I tried below but didn't work

df3 = df1.iloc[np.where(df1.age1 == df2['age1'])]

Thanks for your help

Murali
  • 579
  • 1
  • 6
  • 20

0 Answers0