Linked Questions
10 questions linked to/from How to calculate difference between two dates in weeks in python
0 votes
0 answers
941 views
How do I calculate number of weeks between two dates using Python? [duplicate]
If I have two dates (ex. '3/1/2016' and '2/28/2017') what is the best way to get the difference measured in weeks?
0 votes
0 answers
117 views
Program that calculates the weeks between two dates [duplicate]
I want to write a python code that finds Sundays between 1.1.1500 and 31.12.1600 without using any library. I have printed the dates in the following code.I try to find sunday divide seven but I think ...
595 votes
16 answers
750k views
`/` vs `//` for division in Python
Is there any benefit to use one over the other? In Python 2, they both seem to return the same results: >>> 6/3 2 >>> 6//3 2
10 votes
5 answers
5k views
How to continue the week number when the year changes using pandas
Example: By using df['Week_Number'] = df['Date'].dt.strftime('%U') for 29/12/2019 the week is 52. and this week is from 29/12/2019 to 04/01/2020. but for 01/01/2020 the week is getting as 00. I ...
7 votes
5 answers
344 views
Counting day-of-week-hour pairs between two dates
Consider the following list of day-of-week-hour pairs in 24H format: { 'Mon': [9,23], 'Thu': [12, 13, 14], 'Tue': [11, 12, 14], 'Wed': [11, 12, 13, 14] 'Fri': [13], 'Sat': [], 'Sun': [], } and ...
3 votes
1 answer
3k views
Python Pandas Find all weekends/dates between two date columns
Say I have a data frame with two columns Start End 1/1/2015 1/5/2015 1/10/2015 1/12/2015 What would be the best method to get the dates in between the start and end (the actual dates, not the ...
0 votes
3 answers
1k views
Frequency of events in a week
My data has trips with datetime info, user id for each trip and trip type (single, round, pseudo). Here's a data sample (pandas dataframe), named All_Data: HoraDTRetirada idpass type ...
1 vote
2 answers
811 views
Send weekly emails for a limited time after sign up in django
The Goal: Once a user has signed up they start a challenge. Once they've started the challenge I'd like to be able to send users weekly emails for 12 weeks (Or however long the challenge lasts for). ...
1 vote
1 answer
409 views
How to get the number of weekdays, that have passed since epoch?
With code as simple as shown below, you can get the number of days, that have passed since epoch. from time import time secs = time() day = 24 * 60 * 60 days = int(secs // day) print(days) But now I ...
0 votes
1 answer
67 views
How to interpret Pandas Timestamp as week integer since the Epoc
Docs say I can pull out the week of the year from the timestamp: pd.to_datetime('03-01-2021').week -> 9 But I need weeks since the epoch. I have to do gaps and islands analysis, so I need to wind ...