title: How to get required dataframe after pyspark pivot?
body: <p>I have a spark dataframe:</p>
  <pre><code>+------+----------------+-------+------+---------+
  |name  |           pDate| status|user  |userCount|
  +------+----------------+-------+------+---------+
  |janani|2022-03-04      |active |qwe123|1        |
  |raj   |2022-03-03      |active |qwe123|1        |
  |ram   |2022-03-01      |active |qwe123|1        |
  |ram   |2022-03-02      |active |qwe123|1        |
  +------+----------------+-------+------+---------+
  </code></pre>
  <p>when I pivoted the dataframe with the following code</p>
  <pre><code>pvtcountuser = countuser.groupby('pDate','name').pivot('pDate').max('userCount').fillna(0)
  </code></pre>
  <p>I get:</p>
  <pre><code>+----------------+------+----------+----------+----------+----------+
  |pDate           |name  |2022-03-01|2022-03-02|2022-03-03|2022-03-04|
  +----------------+------+----------+----------+----------+----------+
  |2022-03-04      |janani|0         |0         |0         |1         |
  |2022-03-03      |raj   |0         |0         |1         |0         |
  |2022-03-01      |ram   |1         |0         |0         |0         |
  |2022-03-02      |ram   |0         |1         |0         |0         |
  +----------------+------+----------+----------+----------+----------+
  </code></pre>
  <p>but the required solution needed is:</p>
  <pre><code>+----------------+------+----------+----------+----------+----------+
  |pDate           |name  |2022-03-01|2022-03-02|2022-03-03|2022-03-04|
  +----------------+------+----------+----------+----------+----------+
  |2022-03-04      |janani|0         |0         |0         |1         |
  |2022-03-03      |raj   |0         |0         |1         |0         |
  |2022-03-01      |ram   |1         |1         |0         |0         |
  +----------------+------+----------+----------+----------+----------+
  </code></pre>
  <p>Please help on this</p>