title: Pandas - selecting rows from data frame
body: <p>Hi all I'm new to pandas, I have a dataframe with several rows for given index or id in this case.  I would like to subset this data frame so that for each id i will only get rows up to the first time column A and C are zero and discard rest of the rows with all zeros. </p>
  
  <pre><code>id                            A             B          C            
  10000                     728185.14       1000000    728185.14
  10000                     578311.73       1000000    578311.73
  10000                     496633.66       1000000    496633.66
  10000                     367326.97       1000000    367326.97
  10000                          0.00       1000000         0.00
  10000                          0.00             0         0.00
  10000                          0.00             0         0.00
  10000                          0.00             0         0.00
  10000                          0.00             0         0.00
  </code></pre>
  
  <p>here is what it should look like after i subset the dataframe</p>
  
  <pre><code>id                            A             B          C            
  10000                     728185.14       1000000    728185.14
  10000                     578311.73       1000000    578311.73
  10000                     496633.66       1000000    496633.66
  10000                     367326.97       1000000    367326.97
  10000                          0.00       1000000         0.00
  </code></pre>
  
  <p>Andy ides?</p>
  
  <p>I also have one other question, how can i select last row for each index? So after I do the step above I would like to create a new data frame with a last row for each index.</p>
  
  <pre><code>id                         A            B       C           
  10000                     0.00      1000000    0.00
  10001                     0.00      1000000    0.00
  10002                     0.00      1000000    0.00
  10003                     0.00      1000000    0.00
  10004                     0.00      1000000    0.00
  </code></pre>