title: How do I specify the return type of a PySpark function as a dataframe?
body: <p>I was working on some coding challenges recently that involved passing a Spark dataframe into a Python function and returning a new dataframe.  The syntax I remember was something like:</p>
  
  <pre><code>def sampleFunction(df: Dataframe) -&gt; Dataframe:
      * do stuff *
      return newDF
  </code></pre>
  
  <p>I'm trying to create my own examples now, but I'm unable to specify dataframe as an input/output type.  I assume there's something I need to import to make dataframe an acceptable type, but I have Googled this nonstop for the past hour, and I can't find a single example of how to make this work in PySpark.</p>