Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas combine year month day column to date

1
2
cols=["year","month","day"]
df['date'] = df[cols].apply(lambda x: '-'.join(x.values.astype(str)), axis="columns")
Source by cmdlinetips.com #
 
PREVIOUS NEXT
Tagged: #pandas #combine #year #month #day #column #date
ADD COMMENT
Topic
Name
2+2 =