title: How to create new columns using groupby based on logical expressions
body: <p>I have this CSV file</p>
  
  <p><a href="http://www.sharecsv.com/s/2503dd7fb735a773b8edfc968c6ae906/whatt2.csv" rel="nofollow noreferrer">http://www.sharecsv.com/s/2503dd7fb735a773b8edfc968c6ae906/whatt2.csv</a></p>
  
  <p>I want to create three columns, 'MT_Value','M_Value', and 'T_Data', one who has the mean of the data grouped by year and month, which I accomplished by doing this.</p>
  
  <p><code>data.groupby(['Year','Month']).mean()</code></p>
  
  <p>But for M_value I need to do the mean of only the values different from zero, and for T_Data I need the count of the values that are zero divided by the total of values, I guess that for the last one I need to divide the amount of values that are zero by the amount of total data grouped, but honestly I am a bit lost. I looked on google and they say something about transform but I didn't understood very well</p>
  
  <p>Thank you.</p>