write a pandas/python function which requires as inputs multiple columns in a pandas dataframe
<p>In a dataframe with two columns I can easily create a third without a function if it is a numerical operation such as multiply df["new"] =df["one"] * df["two"].</p>

<p>However what if I need to pass in more than two parameters to a function and those parameters are columns from a dataframe. </p>

<p>Passing one column at a time is simple using: df.apply(my_func) but if the functions definition is, and requires three columns:</p>

<pre><code>def WordLength(col1,col2,col3):
return max(len(col1),len(col2),len(col3))
</code></pre>

<p>For example, A function WordLength would return the maximum length of the word from any of the three columns passed into it.</p>

<p>I know for example this doesn't work but I imagine something like this to return a result of a function requiring three parameters into a dataframe column:</p>

<pre><code>df["word_length"]= df.apply(WordLength, [[param1,param2,param3]])
</code></pre>

<p><strong>Update</strong>
Jon, when trying to use your method of passing in three parameters (values from three dataframe columns for a given row I am getting the following error:</p>

<pre><code>def get(name,start_date,end_date):
    try:
        df = ...

response = df.apply(get, axis=1, args=('name', 'date', 'today')) 
</code></pre>

<p>Error relating to arguments - I don't understand why it mentions 4 arguments when I have passed in three and the function only requires three arguments...</p>

<p>Error: </p>

<blockquote>
  <p>TypeError: ('getprice() takes exactly 3 arguments (4 given)',
  u'occurred at index 0')</p>
</blockquote>