I am using Python 3.6 and having issues getting week numbers starting from Sunday.
How can I find week numbers with weeks starting on Sunday in Python?
t1 = datetime.datetime.now()
t1.strftime("%U")
For example, on 09/16/2018 Sunday it should give WW38 and not WW37, which it is giving now.
I see that both "%U", "%V" and "%W" are giving the same.
Any help will be appreciated.
A small cut of the dataframe is as below:
time value
2018/09/15 1:08:19 PM 11.87
2018/09/16 6:23:17 PM 10.794
2018/09/16 6:37:48 PM 10.313
2018/09/16 6:54:14 PM 10.578
2018/09/16 6:58:24 PM 11.057
2018/09/19 9:08:24 PM 13.09
For each of the time I am creating a WW column.. The issue is that I want the WW to start on Sunday and not Monday.
My code:
ww_l =[]
for date in df['time']:
date_v = datetime.strptime(tv, "%Y-%m-%d %H:%M:%S")
curr_ww = datetime.date(date_v).strftime("%W")
ww_l.append(curr_ww)
df['WW'] = pd.DataFrame(ww_l)