1df[['A','B']] = df[['A','B']].apply(pd.to_datetime) # If conversion required
2df['C'] = (df['B'] - df['A']).dt.days
1# credit to Stack Overflow user in the source link
2import pandas as pd
3# df is your pandas dataframe
4# if already datetime64 you don't need to use to_datetime
5
6df['A'] = pd.to_datetime(df['A'])
7df['B'] = pd.to_datetime(df['B'])
8
9df['diff'] = df['A'] - df['B'] # difference in days