DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
2+3 =
Submit