Pandas manipulate data points [duplicate]

Solution 1:

You could use:

pd.to_datetime("201601", format="%Y%m")

In your case this might be something like:

df["date"] = pd.to_datetime(df["date"], format='%Y%m', errors='coerce')