I have a Pandas Dataframe where two columns contain times (stored as strings).
I want to get the minimum difference (hours, minutes, seconds) between both columns (Column1 and Column2).
I have converted both columns to times as per below and stored them in different dataframes:
I want to get the minimum difference (hours, minutes, seconds) between both columns (Column1 and Column2).
I have converted both columns to times as per below and stored them in different dataframes:
Column1Times = pd.to_datetime(myDataFrame['Column1'], format='%H:%M:%S').dt.time Column2Times = pd.to_datetime(myDataFrame['Column2'], format='%H:%M:%S').dt.timeTo get the minimum time difference I use below, but I get
Error:operand "-" not suuported.
print("Minimum difference is : ", (Column1Times - Column2Times).min())Can someone please tell me what I am doing wrong?