title: Replace value for a selected cell in pandas DataFrame without using index
body: <p>this is a rather similar question to <a href="https://stackoverflow.com/questions/13842088/set-value-for-particular-cell-in-pandas-dataframe" title="Set value for particular cell in pandas DataFrame">this question</a> but with one key difference: I'm selecting the data I want to change not by its index but by some criteria.</p>
  
  <p>If the criteria I apply return a single row, I'd expect to be able to set the value of a certain column in that row in an easy way, but my first attempt doesn't work:</p>
  
  <pre><code>&gt;&gt;&gt; d = pd.DataFrame({'year':[2008,2008,2008,2008,2009,2009,2009,2009], 
  ...                   'flavour':['strawberry','strawberry','banana','banana',
  ...                   'strawberry','strawberry','banana','banana'],
  ...                   'day':['sat','sun','sat','sun','sat','sun','sat','sun'],
  ...                   'sales':[10,12,22,23,11,13,23,24]})
  
  &gt;&gt;&gt; d
     day     flavour  sales  year
  0  sat  strawberry     10  2008
  1  sun  strawberry     12  2008
  2  sat      banana     22  2008
  3  sun      banana     23  2008
  4  sat  strawberry     11  2009
  5  sun  strawberry     13  2009
  6  sat      banana     23  2009
  7  sun      banana     24  2009
  
  &gt;&gt;&gt; d[d.sales==24]
     day flavour  sales  year
  7  sun  banana     24  2009
  
  &gt;&gt;&gt; d[d.sales==24].sales = 100
  &gt;&gt;&gt; d
     day     flavour  sales  year
  0  sat  strawberry     10  2008
  1  sun  strawberry     12  2008
  2  sat      banana     22  2008
  3  sun      banana     23  2008
  4  sat  strawberry     11  2009
  5  sun  strawberry     13  2009
  6  sat      banana     23  2009
  7  sun      banana     24  2009
  </code></pre>
  
  <p>So rather than setting 2009 Sunday's Banana sales to 100, nothing happens! What's the nicest way to do this? Ideally the solution should use the row number, as you normally don't know that in advance!</p>