title: Iterating through rows of a Pandas series within a function
body: <p>I'm writing a function part of which should iterate through the rows of a <code>Series</code>. The function should iterate through rows of a <code>DataFrame</code> column passed to it i.e. df['col'], however when I try to use <code>.iterrows</code> I get an error that a <code>Series</code> doesn't have that attribute and using <code>.iteritems</code> produces the error below. Are there any other ways to iterate through rows of a column? I need do be able to access the index and column value.</p>
  
  <pre><code>def get_RIMsin(df, obs, rimcol):
      """dataframe, obs column,rim column"""    
      maxval =df['Mmedian'].max()
      minval =df['Mmedian'].min()
      dfrange = maxval-minval
      amplitude = dfrange/2
  
      convert = (2*np.pi)/365
      startday = obs.idxmax().dayofyear
      sinmax = 91
  
      for row in rimcol.iteritems: #This is where I'd like to go through rows of a series
          diff = sinmax - startday
          adjday = row.dayofyear + diff
          adjsin = np.sin(adjday * convert)
          df['RIMsine'] = row + adjsin
      return df
  
  get_RIMsin(sve_DOC, sve_DOC['DOC_mg/L'], sve_DOC['RIMsDOC'])
  
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-98-4811cbf80e78&gt; in &lt;module&gt;()
       17     return df
       18 
  ---&gt; 19 get_RIMsin(sve_DOC, sve_DOC['DOC_mg/L'], sve_DOC['RIMsDOC'])
       20 """get_RIM2(svv_DOC, svv_DOC['DOC_mg/L'], svv_DOC['RIMsDOC'])
       21 get_RIM2(svw_DOC, svw_DOC['DOC_filt_mg/l'], svw_DOC['RIMsDOC'])
  
  &lt;ipython-input-98-4811cbf80e78&gt; in get_RIMsin(df, obs, rimcol)
       10     sinmax = 91
       11 
  ---&gt; 12     for row in rimcol.iteritems:
       13         diff = sinmax - startday
       14         adjday = row.dayofyear + diff
  
  TypeError: 'instancemethod' object is not iterable
  </code></pre>