title: Is there a function in python to rename data points and then flip the column and rows
body: <p>I have a sample data from a very large data set. Is there a code that could turn the below table into the output table</p>
  <p>What I would like to achieve is, a way to find how many times a company names occurs (eg A 3 times) and to suffix each occurance into an index for that company. Then to flip the rows and columns as shown below.</p>
  <p>Input table =</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>company</th>
  <th>revenue</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>10</td>
  </tr>
  <tr>
  <td>A</td>
  <td>20</td>
  </tr>
  <tr>
  <td>A</td>
  <td>30</td>
  </tr>
  <tr>
  <td>B</td>
  <td>10</td>
  </tr>
  <tr>
  <td>B</td>
  <td>15</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Output table =</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th></th>
  <th>A_1</th>
  <th>A_2</th>
  <th>A_3</th>
  <th>B_1</th>
  <th>B_2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>revenue</td>
  <td>10</td>
  <td>20</td>
  <td>30</td>
  <td>10</td>
  <td>15</td>
  </tr>
  </tbody>
  </table>
  </div>