Check that elements in list follow a specified date-format schema and are not null/na/nan
One of my friends on Discord helped me out. He didn't like me attempt either! =oP
I created this function:
import datetime

def str2date(string):
   try:
       datetime_holder = datetime.datetime.strptime(string, &quot;%Y-%m-%d&quot;)
       return datetime_holder.date()
   except ValueError:
       return string
   except TypeError:
       return string

And looped over it like this:
def datetime_check_format(col):
tracker = []
false_dates = []
true_dates = []
counter = -1
for element in col:
    counter +=1
    if isinstance(str2date(element), date):
        true_dates.append(str2date(element))
    else:
        tracker.append(counter)
        false_dates.append(str2date(element))

return tracker, false_dates, true_dates