Reputation: 2529
Today is 2nd of January, if using Python pandas, any ideas on how to get the previous workweek?
For example today is work week 201801, and previous week is 201752, any ways can find the previous workweek of today?
Upvotes: 0
Views: 77
Reputation: 323226
Using Timestamp
and Timedelta
(pd.Timestamp.now()-pd.Timedelta('7 days')).strftime('%Y-%U')
Out[148]: '2017-52'
Upvotes: 1