I have two data frame, first named df1 having data as:
Date Exact Latitude Longitude
0 1993-01-01 00:00:00 0.0 29.456137 85.506958
1 2017-10-01 05:00:00 0.0 27.694225 85.291702
2 2017-10-01 06:00:00 0.0 28.962729 80.912323
3 2017-10-02 05:00:00 0.0 27.699097 85.299431
4 2017-10-03 04:00:00 0.0 27.700438 85.329933
and df2 as
Date (LT) Raw Conc.
6551 2017-10-01 00:00:00 10.0
6552 2017-10-01 01:00:00 7.0
6553 2017-10-01 02:00:00 11.0
6554 2017-10-01 03:00:00 11.0
6555 2017-10-01 04:00:00 12.0
6556 2017-10-01 05:00:00 9.0
6557 2017-10-01 06:00:00 7.0
6558 2017-10-01 07:00:00 7.0
I want to merge the two dataframe based on common date and time in columns column Date and Date(LT) so that the final output is like:
Date Exact Raw Conc.
2017-10-02 05:00:00 0.0 9.0
I tried to merge it by using the date of both data frame as an index by using df1.set_index('Date')
. But, when I tried to check the index by using df1.index
, it had not been used as an index. I also tried using :
newfile=df1.loc[(df1.Date==df2.Date)]
It gives me error:
ValueError: Can only compare identically-labeled Series objects
What is it I am missing ?