title: Take n rows from a spark dataframe and pass to toPandas()
body: <p>I have this code:</p>
  
  <pre><code>l = [('Alice', 1),('Jim',2),('Sandra',3)]
  df = sqlContext.createDataFrame(l, ['name', 'age'])
  df.withColumn('age2', df.age + 2).toPandas()
  </code></pre>
  
  <p>Works fine, does what it needs to. Suppose though I only want to display the first n rows, and then call <code>toPandas()</code> to return a pandas dataframe. How do I do it? I can't call <code>take(n)</code> because that doesn't return a dataframe and thus I can't pass it to <code>toPandas()</code>.</p>
  
  <p>So to put it another way, how can I take the top n rows from a dataframe and call <code>toPandas()</code> on the resulting dataframe? Can't think this is difficult but I can't figure it out.</p>
  
  <p>I'm using Spark 1.6.0.</p>