title: How to do lag over window partition similar to SparkR example code in pyspark
body: <p>I am trying to implement something similar to the below SparkR code into pyspark.</p>
  <pre><code>df &lt;- createDataFrame(mtcars)
  # Partition by am (transmission) and order by hp (horsepower)
  ws &lt;- orderBy(windowPartitionBy(&quot;am&quot;), &quot;hp&quot;)
  # Lag mpg values by 1 row on the partition-and-ordered table
  out &lt;- select(df, over(lag(df$mpg), ws), df$mpg, df$hp, df$am)
  </code></pre>
  <p>Does anyone have any idea how to do this on pyspark dataframe?</p>