I have two dataframe as listed below. It was generated using pandas.
df1
0
0 reallocations
1 four
2 payoff
df2
word frequency
whether 1
House 1
Sniderman 1
payoff 6
My goal here is to read df1[0] and check if it exists in df2[word] if it exists then give me an output in the following format.
word frequency
four 0
whether 1
House 1
Sniderman 1
reallocations 0
four 0
payoff 6
Here is what I have tried: df1.intersection(df2). I believe I have to assign a column value for that.
I tried solution from Compare pandas dataframes by multiple columns
I am pretty sure there is a small thing that not allowing me to concatenate the desired result.
Any thoughts?