title: Applying a function to a column that takes another column as an argument in Python Pandas
body: <p>I want to apply a function to an entire column in a Pandas dataframe. This function will overwrite the data currently in that column but requires the value of another column next to it, to illustrate:</p>
  
  <pre><code>col 0, col 1,
   23,   'word'
   45,   'word2'
   63,   'word3'
  </code></pre>
  
  <p>I have tired passing in the number column into Pandas apply method:</p>
  
  <pre><code>df[1] = df.apply(retrieve_original_string(df[0]), axis=1)
  </code></pre>
  
  <p>But this throws an error:</p>
  
  <pre><code>sys:1: DtypeWarning: Columns (3,4) have mixed types. Specify dtype option on import or set low_memory=False.
  Traceback (most recent call last):
    File "/home/noname365/similar_keywords_microsoft/similar_keywords.py", line 95, in &lt;module&gt;
      merged_df[1] = merged_df.apply(retrieve_original_string(merged_df[0], match_df), axis=1)
    File "/home/noname365/similar_keywords_microsoft/similar_keywords.py", line 12, in retrieve_original_string
      row_num = int(row)
    File "/home/noname365/virtualenvs/env35/lib/python3.5/site-packages/pandas/core/series.py", line 81, in wrapper
      "cannot convert the series to {0}".format(str(converter)))
  TypeError: cannot convert the series to &lt;class 'int'&gt;
  </code></pre>
  
  <p>The error implies that I am passing the whole number column to the function instead of individually on a row-by-row basis. How would I accomplish this?</p>