Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create column for year in dataframe python

#Create column in df called 'Year' which extracts the year from the 'Date' column
data['Year'] = (data['Date']).dt.to_period('A')
 
PREVIOUS NEXT
Tagged: #create #column #year #dataframe #python
ADD COMMENT
Topic
Name
2+1 =