title: Pandas How to combine multiple data columns and output as dictionary
body: <p>I am working on csv file.
  The csv table file structure is as</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">brands</th>
  <th style="text-align: center;">models</th>
  <th style="text-align: right;">2021_price</th>
  <th style="text-align: right;">2020_price</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">chevrolet</td>
  <td style="text-align: center;">Traverse</td>
  <td style="text-align: right;">320000</td>
  <td style="text-align: right;">24000</td>
  </tr>
  <tr>
  <td style="text-align: left;">chevrolet</td>
  <td style="text-align: center;">Equinox</td>
  <td style="text-align: right;">23000</td>
  <td style="text-align: right;">18000</td>
  </tr>
  <tr>
  <td style="text-align: left;">chevrolet</td>
  <td style="text-align: center;">Trailblazer</td>
  <td style="text-align: right;">13000</td>
  <td style="text-align: right;">14000</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>this is what I tried on my own</p>
  <pre><code>json_dict = {}
  for index,row in df.iterrows():
      data=(
          {row[0]:{
          ''.join(str(row[1])):
              {
               &quot;2021&quot;:' '.join(str(row[2]).split()),
               '2020':' '.join(str(row[3]).split()),
              }
          }
          }
      )
      json_dict.update(data)
  </code></pre>
  <p>I got this as an output</p>
  <pre><code> {
        &quot;chevrolet&quot;:{
           &quot;Traverse&quot;:{
              &quot;2021&quot;:&quot;320000&quot;,
              &quot;2020&quot;:&quot;24000&quot;,
           },
        
           &quot;chevrolet&quot;:{
           &quot;Equinox&quot;:{
              &quot;2021&quot;:&quot;23000&quot;,
              &quot;2020&quot;:&quot;18000&quot;,
             
           } 
     }
  </code></pre>
  <p>but expected dictionary is as</p>
  <pre><code>{
        &quot;chevrolet&quot;:{
           &quot;Traverse&quot;:{
              &quot;2021&quot;:&quot;320000&quot;,
              &quot;2020&quot;:&quot;24000&quot;
           },
        
           &quot;Equinox&quot;:{
              &quot;2021&quot;:&quot;23000&quot;,
              &quot;2020&quot;:&quot;18000&quot;
           } 
     }
  </code></pre>
  <p>this is sample of file</p>
  <pre><code>NISSAN    Patrol Platinum City  1,260,000,000.00 UZS   Nan      
      NISSAN       Qasgqai        315,000,000.00 UZS    315,000,
      NISSAN       X-Trail        367,500,000.00 UZS     Nan
  </code></pre>