how to separate year from datetime column in python

Solutions on MaxInterview for how to separate year from datetime column in python by the best coders in the world

we are a community of more than 2 million smartest coders
showing results for - "how to separate year from datetime column in python"
Yannick
28 Aug 2016
1df['year'] = pd.DatetimeIndex(df['ArrivalDate']).year
2df['month'] = pd.DatetimeIndex(df['ArrivalDate']).month
3