title: How to convert python data frame to json of fixed keys and dataframe columns as values
body: <p>Required to convert dataframe values into json format which will be feed for an external reporting system. Sample dataframe values and required json format is shared below.
  Note: These Category can span to 1000 records or even more. Required to process the data efficiently</p>
  <p>Data Frame Values</p>
  <pre><code>    **Category**   **catgName**    **catgCode**
      Vegies     Carrot  V001
      Fruit      Mango   F001
      Leaf       Mint    L001
      ExtFruit   Berry   EF01
      Fruit      Papaya  F002
      Vegies     Tomato  V002
  </code></pre>
  <p>Required Json Output</p>
  <pre><code>    {
          &quot;externalFeed&quot;: {
              &quot;Vegies&quot;: {
                  &quot;count&quot;: &quot;2&quot;,
                  &quot;details&quot;: [{
                          &quot;catgName&quot;: &quot;Carrot&quot;,
                          &quot;catgCode&quot;: &quot;V001&quot;
                      },
                      {
                          &quot;catgName&quot;: &quot;Tomato&quot;,
                          &quot;catgCode&quot;: &quot;V002&quot;
                      }
                  ]
              },
              &quot;Fruit&quot;: {
                  &quot;count&quot;: &quot;2&quot;,
                  &quot;details&quot;: [{
                          &quot;catgName&quot;: &quot;Mango&quot;,
                          &quot;catgCode&quot;: &quot;F001&quot;
                      },
                      {
                          &quot;catgName&quot;: &quot;Papaya&quot;,
                          &quot;catgCode&quot;: &quot;F002&quot;
                      }
                  ]
              },
              &quot;Leaf&quot;: {
                  &quot;count&quot;: &quot;1&quot;,
                  &quot;details&quot;: [{
                              &quot;catgName&quot;: &quot;Mint&quot;,
                              &quot;catgCode&quot;: &quot;L001&quot;
                          }
                      ]
              },
              &quot;ExtFruit&quot;: {
                      &quot;count&quot;: &quot;1&quot;,
                      &quot;details&quot;: [{
                              &quot;catgName&quot;: &quot;Berry&quot;,
                              &quot;catgCode&quot;: &quot;EF01&quot;
                          }
                      ]
              }
          }
      }
  </code></pre>
  <p>Thanks in advance</p>