title: pyspark equivalent of pandas groupby('col1').col2.head()
body: <p>I have a Spark Dataframe where for each set of rows with a given column value (col1), I want to grab a sample of the values in (col2). The number of rows for each possible value of col1 may vary widely, so i'm just looking for a set number, say 10, of each type. </p>
  
  <p>There may be a better way to do this, but the natural approach seemed to be a df.groupby('col1')</p>
  
  <p>in pandas, I could do df.groupby('col1').col2.head() </p>
  
  <p>i understand that spark dataframes are not pandas dataframes, but this is a good analogy. </p>
  
  <p>i suppose i could loop over all of col1 types as a filter, but that seems terribly icky. </p>
  
  <p>any thoughts on how to do this? thanks. </p>