def make_date(df:DataFrame, date_field:str):
    "Make sure `df[field_name]` is of the right date type."
    field_dtype = df[date_field].dtype
    if isinstance(field_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype):
        field_dtype = np.datetime64
    if not np.issubdtype(field_dtype, np.datetime64):
        df[date_field] = pd.to_datetime(df[date_field], infer_datetime_format=True)
def make_date ( df : DataFrame , date_field : str ) : field_dtype = df [ date_field ] . dtype if isinstance ( field_dtype , pd . core . dtypes . dtypes . DatetimeTZDtype ) : field_dtype = np . datetime64 if not np . issubdtype ( field_dtype , np . datetime64 ) : df [ date_field ] = pd . to_datetime ( df [ date_field ] , infer_datetime_format = True )
Make sure `df[field_name]` is of the right date type.