Create a table filtering by year and the remaining days between two dates

Viewed 21

I have a dataframe in python with two dates and several rows.

start end
05/05/2022 09/10/2025
02/07/2023 12/03/2027

I would like to split by year and the Remaining days till the end day. Similar to this.

start end 2022 2023 2024 2025 2026 2027
05/05/2022 09/10/2025 240 365 366 281 nan nan
02/07/2023 12/03/2027 nan 182 366 365 365 70

There are more rows

Many thanks in advance

0 Answers
Related