title: How to prevent: "UserWarning: Boolean Series key will be reindexed to match DataFrame index"
body: <p>I am having some issues with my Python code. When working with DataFrames I get a UserWarning and I'm not really sure of how to prevent it.</p>
  <pre><code>for index in matplatsID:
        mask = (kameraData[&quot;Tid&quot;].dt.hour &gt;= timme) &amp; (kameraData[&quot;Tid&quot;].dt.hour &lt; timme+1)
        matplatsSummaHastigheter += kameraData[mask][kameraData[&quot;MätplatsID&quot;] == index][&quot;Hastighet&quot;].sum()
        matplatsAntalFordon += kameraData[mask][kameraData[&quot;MätplatsID&quot;] == index][&quot;Hastighet&quot;].count()
    
  </code></pre>
  <pre><code>UserWarning: Boolean Series key will be reindexed to match DataFrame index.
    matplatsSummaHastigheter += kameraData[mask][kameraData[&quot;MätplatsID&quot;] == index][&quot;Hastighet&quot;].sum()
  UserWarning: Boolean Series key will be reindexed to match DataFrame index.
    matplatsAntalFordon += kameraData[mask][kameraData[&quot;MätplatsID&quot;] == index][&quot;Hastighet&quot;].count()
  </code></pre>
  <p>It generates these warnings, and I am dumbfounded of how to avoid them, any ideas of what to do?</p>