I've joined 2
dataframes and I also would like to calculate on join the difference
between the timestamp from the second DF with the timestamp from the 1st DF.
Here's the code:
from datetime import datetime
import pandas as pd
EMPLOYEES = "------------------";
CLIENTS = "------------------";
employeesDF = pd.read_csv(EMPLOYEES)
employeesDF = employeesDF[['personId','creationDate']]
clientsDF = pd.read_csv(CLIENTS);
clientsDF = clientsDF[['personId','creationDate']]
# how
final = employeesDF.merge(clientsDF, on="personId", how='inner')
How can we also calculate the difference between creationDate
of the 1st DF and creationDate
of the 2nd DF ?
Sample Data
personId,creationDate_x,creationDate_y, Difference <<<<---- Missing
XFJDSHKJDSS1213,2022-03-06 07:38:51.684+00,2022-03-06 07:39:56.966+00
DKJFKJKDSFJ3332,2022-03-06 07:38:51.684+00,2022-03-06 07:40:56.966+00