title: How to set a flag in groupby with a condition in pandas
body: <p>I have a following dataframe</p>
  
  <pre><code>  code   date         time     product  tank     stock     out_value 
    123    2019-06-20   07:00    MS       1        370       350
    123    2019-06-20   07:30    HS       3        340       350
    123    2019-06-20   07:00    MS       2        340       350
    123    2019-06-20   07:30    HS       4        340       350
    123    2019-06-20   08:00    MS       1        470       350
    123    2019-06-20   08:30    HS       3        450       350
    123    2019-06-20   08:00    MS       2        470       350
    123    2019-06-20   08:30    HS       4        490       350
    123    2019-06-20   09:30    HS       4        0         350
    234    2019-06-20   09:30    HS       1        200       350
  </code></pre>
  
  <p>I want to find out which <code>stock</code> values are less than <code>out_value</code> in above dataframe excluding <code>0</code> value. 
  e.g. at <code>07:30</code> for ro code <code>123</code> on date <code>2019-06-20</code> for product <code>HS</code> there are two tanks <code>3</code> and <code>4</code>, so if stocks for both the tanks are below <code>out_value</code> then flag is set to <code>1</code>. </p>
  
  <p>My desired dataframe would be</p>
  
  <pre><code>  code   date         time     product  tank     stock     out_value    flag
    123    2019-06-20   07:00    MS       1        370       350          0
    123    2019-06-20   07:30    HS       3        340       350          1
    123    2019-06-20   07:00    MS       2        340       350          0
    123    2019-06-20   07:30    HS       4        340       350          1
    123    2019-06-20   08:00    MS       1        470       350          0
    123    2019-06-20   08:30    HS       3        450       350          0
    123    2019-06-20   08:00    MS       2        470       350          0
    123    2019-06-20   08:30    HS       4        490       350          0
    123    2019-06-20   09:30    HS       4        0         350          0
    234    2019-06-20   09:30    HS       1        200       350          1
  </code></pre>
  
  <p>How can I do it in pandas?</p>