title: How to pivot columns so they turn into rows using PySpark or pandas?
body: <p>I have a dataframe that looks like the one bellow, but with hundreds of rows. I need to pivot it, so that each column after <code>Region</code> would be a row, like the other table bellow.</p>
  <pre class="lang-none prettyprint-override"><code>+--------------+----------+---------------------+----------+------------------+------------------+-----------------+
  |city          |city_tier | city_classification |  Region  | Jan-2022-orders  | Feb-2022-orders  |  Mar-2022-orders|
  +--------------+----------+---------------------+----------+------------------+------------------+-----------------+
  |new york      | large    |    alpha            |   NE     | 100000           |195000            | 237000          |
  |los angeles   | large    |    alpha            |   W      | 330000           |400000            | 580000          |
  </code></pre>
  <p>I need to pivot it using PySpark, so I end up with something like this:</p>
  <pre class="lang-none prettyprint-override"><code>+--------------+----------+---------------------+----------+-----------+---------+
  |city          |city_tier | city_classification |  Region  | month     | orders  |
  +--------------+----------+---------------------+----------+-----------+---------+
  |new york      | large    |    alpha            |   NE     | Jan-2022  | 100000  |
  |new york      | large    |    alpha            |   NE     | Fev-2022  | 195000  |
  |new york      | large    |    alpha            |   NE     | Mar-2022  | 237000  |
  |los angeles   | large    |    alpha            |   W      | Jan-2022  | 330000  |
  |los angeles   | large    |    alpha            |   W      | Fev-2022  | 400000  |
  |los angeles   | large    |    alpha            |   W      | Mar-2022  | 580000  |
  </code></pre>
  <p>P.S.: A solution using pandas would work too.</p>