Pandas convert column with year integer to datetime Pandas convert column with year integer to datetime python-3.x python-3.x

Pandas convert column with year integer to datetime


Use format='%Y'

In [225]: pd.to_datetime(df.Year, format='%Y')Out[225]:0   2015-01-011   2014-01-012   2010-01-01Name: Year, dtype: datetime64[ns]

Details

In [226]: dfOut[226]:   Year0  20151  20142  2010