title: How to compile/combine multiple lines of code inside a function in python?
body: <p>I have few lines of code wherein I am reading a csv file (df), manipulating some rows, columns of it, appending it with another csv file (esg)</p>
  <pre><code>df = df.append(esg)
  df['SourceUrl'] = df['SourceUrl'].apply(lambda x: x.lstrip('htps://')if pd.notnull(x) else np.nan)
  df['AvailableAt'] = df['AvailableAt'].apply(lambda x: processDate(x))
  df['PublishedAt'] = df['PublishedAt'].apply(lambda x: processDate(x))
  df['LastModified'] = df['LastModified'].apply(lambda x: processDate(x))
  df[&quot;sig_compid_pubdt&quot;] = df[&quot;CompanyId&quot;]+&quot;_&quot;+df[&quot;PublishedAt&quot;]
  </code></pre>
  <p>Now, I want to know that</p>
  <ol>
  <li>How can I compile all these above lines of code within a function ??</li>
  <li>What are the arguments which is needed to be passed and how will I know it??</li>
  <li>What is to be returned?? How is 'return' keyword used?? In what conditions, is it necessary to be used??</li>
  </ol>
  <p>Suggestions please</p>