Transform string of format ‘YYYY-MM-DD’ to date type in Python
date_str = "2020-04-30"
import datetime

def date_string_to_datetime(date_str):
  return datetime.datetime.strptime(date_str, "%Y-%m-%d").date()