Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

week of the year pandas

from datetime import date
df_date = pd.DataFrame([date.today()],columns  = ['today'])
print(df_date)
#### Print Output ####
#        today
#0  2019-09-07
df_date['weeknum'] = df_date.today.apply(lambda x:x.isocalendar()[1])
print(df_date)
#### Print Output ####
#        today  weeknum
#0  2019-09-07       36
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #week #year #pandas
ADD COMMENT
Topic
Name
9+2 =