I have two DataFrames:
df1 = ['Date_Time',
'Temp_1',
'Latitude',
'N_S',
'Longitude',
'E_W']
df2 = ['Date_Time',
'Year',
'Month',
'Day',
'Hour',
'Minute',
'Seconds']
As You can see both DataFrames have Date_Time as a common column. I want to Join these two DataFrames by matching Date_Time.
My current code is: df.join(df2, on='Date_Time'), but this is giving an error.
You are looking for a
merge:The keywords are the same as for
join, butjoinuses only the index, see “Database-style DataFrame joining/merging”.Here’s a simple example:
If you try and join on a column you get an error:
See “Joining key columns on an index”.