How to exclude a single value from Groupby method using Pandas
<p>I have a dataframe where I have transformed all NaN to 0 for a specific reason. In doing another calculation on the df, my group by is picking up a 0 and making it a value to perform the counts on. Any idea how to get python and pandas to exclude the 0 value? In this case the 0 represents a single row in the data. Is there a way to exclude all 0's from the groupby?</p>

<p>My groupby looks like this</p>

<pre><code>  +----------------+----------------+-------------+
  | Team           | Method         |  Count      |
  +----------------+----------------+-------------+
  | Team 1         | Automated      |           1 |
  | Team 1         | Manual         |          14 |
  | Team 2         | Automated      |           5 |
  | Team 2         | Hybrid         |           1 |
  | Team 2         | Manual         |          25 |
  | Team 4         | 0              |           1 |
  | Team 4         | Automated      |           1 |
  | Team 4         | Hybrid         |          13 |
  +----------------+----------------+-------------+
</code></pre>

<p>My code looks like this (after importing excel file)</p>

<pre><code>  df = df1.filnna(0)
  a = df[['Team', 'Method']]
  b = a.groupby(['Team', 'Method']).agg({'Method' : 'count'}
</code></pre>