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
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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