title: How to multiply a child dummy variable with its respective ratios in python?
body: <p>What I want to do is add the ratios in the 1st table based on the correct child in the 2nd table.
  So for example for the 1st observation I want to do 0.52 (1st child 16-17)+0.84 (2nd child 11-13)+0.78 (3rd child 0-3)=2.14 and create a new column for those values.</p>
  <p>There are no observations with more than 1 child in any age range. The &quot;Child_18-older_18&quot; and &quot;Pregnant&quot; columns should be seen as someone with an age of 16-17 and 0-3 in the ratio table, respectively. With regards to the 2nd table, the entire dataframe consists of 4000 observations. These 5 observations were picked randomly</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Age</th>
  <th>First_child_ratio</th>
  <th>Second_child_ratio</th>
  <th>Third_child_ratio</th>
  <th>Fourth_child_ratio</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0-3</td>
  <td>1.0</td>
  <td>0.72</td>
  <td>0.78</td>
  <td>0.66</td>
  </tr>
  <tr>
  <td>4-6</td>
  <td>0.83</td>
  <td>0.6</td>
  <td>0.65</td>
  <td>0.54</td>
  </tr>
  <tr>
  <td>7-10</td>
  <td>0.77</td>
  <td>0.69</td>
  <td>0.73</td>
  <td>0.59</td>
  </tr>
  <tr>
  <td>11-13</td>
  <td>0.88</td>
  <td>0.84</td>
  <td>0.87</td>
  <td>0.86</td>
  </tr>
  <tr>
  <td>14-15</td>
  <td>0.52</td>
  <td>0.52</td>
  <td>0.68</td>
  <td>0.68</td>
  </tr>
  <tr>
  <td>16-17</td>
  <td>0.52</td>
  <td>0.52</td>
  <td>0.52</td>
  <td>0.52</td>
  </tr>
  </tbody>
  </table>
  </div><div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Pregnant</th>
  <th>Child_0-3</th>
  <th>Child_4-6</th>
  <th>Child_7-10</th>
  <th>Child_11-13</th>
  <th>Child_14-15</th>
  <th>Child_16-17</th>
  <th>Child_18-older_18</th>
  <th>No_Child</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>1</td>
  <td>0</td>
  </tr>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  </tr>
  </tbody>
  </table>
  </div>