I have a CSV file with 1600 dates and I'm trying to find all missing dates. For example:
03-10-2019
01-10-2019
29-09-2019
28-09-2019
should return : 02-10-2019,30-09-2019.
Here's what I've wrote:
with open('measurements.csv','r') as csvfile:
df = pd.read_csv(csvfile, delimiter=',')
timestamps = df['observation_time'] #Getting only the date
for line in timestamps:
date_str = line
try: # convert string to time
date = date_time_obj = datetime.datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')
dates.append(date)
except:
print("Date parsing failed")
dates = pd.DataFrame(dates,columns =['actual_date'])
pd.date_range(start = dates.min(), end = dates.max()).difference(dates.index)
This returns an error that
"Cannot convert input [actual_date 2018-09-17 22:00:00 dtype: datetime64[ns]] of type to Timestamp"