New to Python, and have already spent 30 minutes reviewing old responses, but still can't figure this out.
'Year' variable is a string. Examples: 1990, 2010. I need to convert to date format, but just with the 4 year "digits". Tried the following, but none are working:
date1 = datetime.datetime.date('Year', "%Y")
datetime.datetime.strftime('Year', "%Y")
wcData.astype(str).apply(lambda x: pd.to_datetime('Year', format='%Y'))
df.astype(str).apply(lambda x: pd.to_datetime(x, format='%Y%m%d'))
Please help!