Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

to extract out only year month from a date column in pandas

df['month_year'] = df['date_column'].dt.to_period('M')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #extract #year #month #date #column #pandas
ADD COMMENT
Topic
Name
7+5 =