Skip to content
Advertisement

Get all dates between start and end date pandas columns

I’m trying to get a list of dates between two start and end date pandas columns, with individual IDs. I’ve found an answer that is basically what I’m after (https://stackoverflow.com/a/53409207/14463396) but this only works if the periods between the start and end dates don’t overlap, and I can’t seem to work out how to adapt this/use an alternative method to get the output I’m after.

Below is an example dataframe:

JavaScript

And this is what the desired output should be:

JavaScript

Any help greatly appreciated :)

Advertisement

Answer

Try with create the date list then explode

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement