title: sort pyspark dataframe within groups
body: <p>I would like to sort column <code>"time"</code> within each <code>"id"</code> group.</p>
  
  <p>The data looks like:</p>
  
  <pre class="lang-python prettyprint-override"><code>id  time  name
  132  12   Lucy
  132  10   John
  132  15   Sam
  78   11   Kate
  78   7    Julia
  78   2    Vivien
  245  22   Tom
  </code></pre>
  
  <p>I would like to get this:</p>
  
  <pre class="lang-python prettyprint-override"><code>id  time  name
  132  10   John
  132  12   Lucy
  132  15   Sam
  78   2    Vivien
  78   7    Julia
  78   11   Kate
  245  22   Tom
  </code></pre>
  
  <p>I tried </p>
  
  <pre class="lang-python prettyprint-override"><code>df.orderby(['id','time'])
  </code></pre>
  
  <p>But I don't need to sort <code>"id"</code>.</p>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>Can I just sort <code>"time"</code> within same <code>"id"</code>? and How?</li>
  <li>Will be more efficient if I just sort <code>"time"</code> than using <code>orderby()</code> to sort both columns?</li>
  </ol>