Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

extract year from datetime pandas

df['date'] = pd.to_datetime(df['date'],format='%Y%m%d')
df['year'] = pd.DatetimeIndex(df['date']).year
df['month'] = pd.DatetimeIndex(df['date']).month
 
PREVIOUS NEXT
Tagged: #extract #year #datetime #pandas
ADD COMMENT
Topic
Name
3+3 =