title: python function missing 2 required positional arguments: ln1, ln2
body: <pre><code>def di(l1,l2, ln1, ln2):  
     dlt = (l2-l1)
     dln = (ln2-ln1)    
     d = dlt * dln
  return d
  
  abc = newdf[['l1','l2','ln1','ln2']]
  abc.columns
  </code></pre>
  
  <p>Function working without errors. But while working on dataframe, it showing error as</p>
  
  <blockquote>
    <p>di() missing 2 required positional arguments: ln1, ln2</p>
  </blockquote>
  
  <pre><code>newdf = newdf.withColumn('newcolnm',reduce(di, ( newdf[col] for col in abc.columns ) ))
  </code></pre>