week of the year pandas

Solutions on MaxInterview for week of the year pandas by the best coders in the world

showing results for - "week of the year pandas"
Edric
05 Feb 2019
1from datetime import date
2df_date = pd.DataFrame([date.today()],columns  = ['today'])
3print(df_date)
4#### Print Output ####
5#        today
6#0  2019-09-07
7df_date['weeknum'] = df_date.today.apply(lambda x:x.isocalendar()[1])
8print(df_date)
9#### Print Output ####
10#        today  weeknum
11#0  2019-09-07       36
12