title: Split a row into multiple rows (to another dataframe) by date range
body: <p>I have a dataset in pandas that contains date range info:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Project Name</th>
  <th>Project Lead</th>
  <th>Start Date</th>
  <th>End Date</th>
  <th>Hours</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Project 1</td>
  <td>Me</td>
  <td>Jan 1, 2022</td>
  <td>Jan 5, 2022</td>
  <td>10</td>
  </tr>
  <tr>
  <td>Project 2</td>
  <td>Myself</td>
  <td>Mar 1, 2022</td>
  <td>Mar 5, 2022</td>
  <td>20</td>
  </tr>
  <tr>
  <td>Project 3</td>
  <td>I</td>
  <td>Jun 1, 2022</td>
  <td>Jun 5, 2022</td>
  <td>30</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The end goal is to break each line into a daily entry, counting only workdays, and divide hours by the number of days. Something like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Project Name</th>
  <th>Project Lead</th>
  <th>Start Date</th>
  <th>End Date</th>
  <th>Hours</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Project 1</td>
  <td>Me</td>
  <td>Jan 1, 2022</td>
  <td>Jan 1, 2022</td>
  <td>2</td>
  </tr>
  <tr>
  <td>Project 1</td>
  <td>Me</td>
  <td>Jan 2, 2022</td>
  <td>Jan 2, 2022</td>
  <td>2</td>
  </tr>
  <tr>
  <td>Project 1</td>
  <td>Me</td>
  <td>Jan 3, 2022</td>
  <td>Jan 3, 2022</td>
  <td>2</td>
  </tr>
  <tr>
  <td>Project 1</td>
  <td>Me</td>
  <td>Jan 4, 2022</td>
  <td>Jan 4, 2022</td>
  <td>2</td>
  </tr>
  <tr>
  <td>Project 1</td>
  <td>Me</td>
  <td>Jan 5, 2022</td>
  <td>Jan 5, 2022</td>
  <td>2</td>
  </tr>
  <tr>
  <td>Project 2</td>
  <td>Myself</td>
  <td>Mar 1, 2022</td>
  <td>Mar 1, 2022</td>
  <td>4</td>
  </tr>
  <tr>
  <td>Project 2</td>
  <td>Myself</td>
  <td>Mar 2, 2022</td>
  <td>Mar 2, 2022</td>
  <td>4</td>
  </tr>
  <tr>
  <td>Project 2</td>
  <td>Myself</td>
  <td>Mar 3, 2022</td>
  <td>Mar 3, 2022</td>
  <td>4</td>
  </tr>
  <tr>
  <td>Project 2</td>
  <td>Myself</td>
  <td>Mar 4, 2022</td>
  <td>Mar 4, 2022</td>
  <td>4</td>
  </tr>
  <tr>
  <td>Project 2</td>
  <td>Myself</td>
  <td>Mar 5, 2022</td>
  <td>Mar 5, 2022</td>
  <td>4</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I'm still new to Python but this is my attempt:</p>
  <ol>
  <li>create a function</li>
  </ol>
  <pre><code>def split_days(row) :
      v_Temp_Start_Date = row[&quot;Start Date&quot;]
      v_Temp_End_Date   = row[&quot;End Date&quot;]
      v_Workday_Count   = pandas.bdate_range(row[&quot;Start Date&quot;], row[&quot;End Date&quot;])
      v_Avg_Hours       = round((row[&quot;Hours&quot;] / v_Workday_Count), 2)
      
      while v_Temp_Start_Date &lt;= v_Temp_End_Date:
          if v_Temp_Start_Date.weekday() &lt;= 4 :
              T_Temp1 = pandas.DataFrame(row[&quot;ProjectName&quot;], row[&quot;Project Lead&quot;], v_Temp_Start_Date, \
              v_Temp_Start_Date, v_Avg_Hours)
              T_output = T_output.append(T_Temp1)
          v_Temp_Start_Date += datetime.timedelta(days=1)
  </code></pre>
  <pre><code>T_Final = pandas.concat(T_Source_Data.apply(lambda row: split_days(row), axis = 1))
  </code></pre>
  <p>Completely not working of course but I don't even know where to start to find out what the problem is.</p>
  <p>I tried to run it before I post here to get more detail error but my application is behaving and cannot load...</p>