It is flagging an error. However, what I'm planning to do is to take the DateDpt and DateAr and look the range between them i.e DatePpt – DateAr. So that I can loop through the difference in dates and find other dates that fall between them considering maximum difference and place of Arrival and departure.
import datetime
import pandas.io.data
from pandas_datareader import data, wb
import csv
import time
df = pd.read_csv('data.csv')
df.DateDpt = pd.to_datetime(df.DateDpt, format='%y-%m-%d')
df.DateAr = pd.to_datetime(df.DateAr, format='%y-%m-%d')
print df
Data:
ID ArCityArCountry DptCityDptCountry DateDpt DateAr
1922 ParisFrance NewYorkUnitedState 2008-03-10 2001-02-02
1002 LosAngelesUS CaliforniaUS 2008-03-10 2008-12-01
1901 ParisFrance LagosNigeria 2001-03-05 2001-02-02
1922 ParisFrance NewYorkUSt 2011-02-03 2008-12-01
1002 ParisFrance CaliforniaUS 2003-03-04 2002-03-04
1099 ParisFrance BeijingChina 2011-02-03 2009-02-04
1901 LosAngelesUS ParisFrance 2001-03-05 2001-02-02
Error:
ValueError: time data '2008-03-10' does not match format '%y-%m-%d' (match)