title: Python - Group by with condition
body: <p>I am trying do gropby function with condition and I am not sure how to get this to work.</p>
  <p>Here is how my data looks like:</p>
  <pre><code>        generated_id    timestamp   direction   date    hour
  0   1   1590394859141   forward 2020-05-25 04:20:59.141000-04:00    4
  1   2   1599758616945   forward 2020-09-10 13:23:36.945000-04:00    13
  2   3   1599759625509   backward    2020-09-10 13:40:25.509000-04:00    13
  </code></pre>
  <p>I need to get count of values &quot;forward&quot; direction for each hour. Based on the same data above, I should have one value &quot;forward at 4 and 1 &quot;forward&quot; values for 13.</p>
  <p>I am trying to use this:</p>
  <pre><code>daily_sum = daily_df.groupby(&quot;hour&quot;)['direction'].count().reset_index()
  </code></pre>
  <p>Direction can also be backwards so I only need to focus on forward.</p>
  <p>How do I do this?</p>