I'm trying to find all rows where the timestamps from one dataframe are the same as the timestamps from another dataframe. The problem is that the two dataframes have different lengths AND when they have the same timestamp, those two rows will be from different rows in their respective dataframes. The gist is that I want to compare a timestamp from one dataframe to every row of another dataframe.
I used df1[df1.eq(df2) == True]
but this relies on the timestamps that are the same having the same index value. The eq
method returns False
even if two of the same timestamps exist in both dataframes but are on different rows.
Ex.
df1
0 2000-01-01 00:00:00
1 2000-01-02 00:00:00
2 2000-01-03 00:00:00
df2
0 2000-01-02 00:00:00
1 2000-01-03 00:00:00
2 2000-01-04 00:00:00
df1.eq(df2)
returns
0 False
1 False
2 False
even though 2000-01-02 00:00:00
and 2000-01-03 00:00:00
exist in both the dataframes.