I have a list of dates in my CSV file which when imported and parsed gives me the below output
df = pd.read_csv('datelist.csv',parse_dates=['date'])
df.head(5)
date
0 2020-04-01
1 2020-04-02
2 2020-04-03
3 2020-04-04
4 2020-04-05
type(df.date[0])
pandas._libs.tslibs.timestamps.Timestamp
I have a range as below
myrange = pd.date_range(start=start_date,end=end_date)
DatetimeIndex(['2020-04-24', '2020-04-25', '2020-04-26', '2020-04-27',
'2020-04-28', '2020-04-29', '2020-04-30', '2020-05-01',
'2020-05-02', '2020-05-03', '2020-05-04', '2020-05-05',
'2020-05-06', '2020-05-07', '2020-05-08', '2020-05-09',
'2020-05-10'],
dtype='datetime64[ns]', freq='D')
I want to check if each item in myrange if it is present in df.date column and do some code, so i am trying this but all result come to false
for i in rng:
if i in df.date[:]:
print('is in the df')
else:
print('is not in the list')
output i get is "is not in the list" for all items
any suggestions on this please