Calculate days for each years between two dates in a pandas dataframe

I have a usecase wherein the from and to dates are provided. I need to calculate the total_days in each year and the total orders for each year. I'm currently coding in python Below is an example

OrderNo From_dt   To_dt        
1        6/11/2017  7/8/2019
2        06/02/2018  10/02/2018

Target Data that I want to achieve:

Year Total_Days Total_Orders 2017 300 20 2018 200 10 2019 400 70

I need to dynamically create the years like in the first example 2018 will have 364 days and 2019 will have 190 days. In the second case since just 1 years is involved I can just fill the 2018 column Eventually I need to add all the days in 2017, 2018,2019 and so on to get total_days.Similarly total_orders for each year.

I'm confused on how to get started with the above problem.

Topic data-science-model python

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.