I am working on a Dataframe in which there two column checkin date & checkout date. Initially those two columns were in string type. I have changed them to date time object and calculate days difference between then using checkout date - checkin date. Now I want to filter rows based on the stay duration. Could any one help me to do that as the difference came in also in datetime object format. Here is my code so far:
New_Train['checkin_date']=pd.to_datetime(New_Train['checkin_date'])
New_Train['checkout_date']=pd.to_datetime(New_Train['checkout_date'])
print(New_Train.info())
#Now, Checking date & checkout date type changed to date time
New_Train['Checkin_Year'],New_Train['Checkin_Month']=
New_Train['checkin_date'].dt.year,New_Train['checkin_date'].dt.month
New_Train['Stay_Duration'] = New_Train['checkout_date']- New_Train['checkin_date']
Thanks in Advance