title: Pyspark - Get first column occurrence of a value in a spark dataframe
body: <p>I have a data-frame as below, I need first, last occurrence of the value 0 and non zero values</p>
  
  <pre><code>Id  Col1  Col2  Col3  Col4
  1    1     0     0      2
  2    0     0     0      0
  3    4     2     2      4
  4    2     5     9      0
  5    0     4     0      0
  
  Expected Result:    
  Id  Col1  Col2  Col3  Col4 First_0 Last_0 First_non_zero Last_non_zero
  1    1     0     0      2   2        3         1               4
  2    0     0     0      0   1        4         0               0
  3    4     2     2      4   0        0         1               4
  4    2     5     9      0   4        4         1               3
  5    0     4     0      0   1        4         2               2
  </code></pre>