title: How can I pass arguments dynamically to a DataFrame.apply() lambda function?
body: <p>I'm trying to run the Pandas <code>apply()</code> method for a Dataframe to create a new column, as follows:</p>
  
  <pre><code>df['new_column'] = df.groupby(groupby).apply(lambda x: some_function(x, df['existing_column']))
  </code></pre>
  
  <p>So, basically, I'm trying to pass the second argument of <code>some_function</code> dynamically, relative to what <code>df['existing_column']</code> stores as a value for each row (values differ).</p>
  
  <p>The error I get is the common <code>TypeError: 'Series' objects are mutable, thus they cannot be hashed</code>. Is there a proper way to to this? I tried doing a for-loop for each row, but that kills my CPU.</p>