title: Python pandas dataframe.stack() and convert to Json to create a dataTable.js
body: <p>I have this code </p>
  
  <pre><code>#Initial dataFrame
  
    Coupon Value Face Value  Percent - PV of FACE  Present Value Rate - SAIR
  0            8       1000              9.619702      96.197019         .34
  </code></pre>
  
  <pre><code>df_pvBondsStacked = df_pvBonds.stack()
                      print(df_pvBondsStacked)
  </code></pre>
  
  <p>prints at terminal as below </p>
  
  <pre><code>0  Coupon Value                 8
     Face Value                1000
     Percent - PV of FACE    9.6197
     Present Value           96.197
     Rate - SAIR                .34
  
  </code></pre>
  
  <p>I have referred the official pandas docs here - <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_json.html" rel="nofollow noreferrer">https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_json.html</a></p>
  
  <p>and coded as below - </p>
  
  <pre><code>df_pvBondsStacked.columns = ['Col_1','Col_2']
  # this line of code up here - does nothing ?
  data = data = json.loads(df_pvBondsStacked.to_json(orient='split'))
  dict_json = {}
  dict_json['data_json'] = data
  print(dict_json)
  
  </code></pre>
  
  <p>terminal prints as below - </p>
  
  <pre><code>{'data_json': {'index': [[0, 'Coupon Value'], [0, 'Face Value'], [0, 'Percent - PV of FACE'], [0, 'Present Value'], [0, 'Rate - SAIR']], 'data': ['8', '1000', 9.619701877, 96.1970187705, '.34'], 'name': None}}
  </code></pre>
  
  <p>Also if i pass params for orient , .to_json(orient='') - "values" , "index",and "table" ,  i get ERROR printed in terminal -  </p>
  
  <pre><code>Error = json.decoder.JSONDecodeError: Expecting ':' delimiter: line 1 column 7 (char 6)
  </code></pre>
  
  <p>My Question -- How to create Column Headers for the data frame = <code>df_pvBondsStacked</code> , as i dont think i can have <strong>valid JSON</strong> to pass to the dataTables.js , without creating Column Headers ? </p>