I'm using Python to try and return a dataset after transforming it a bit.
Currently, it works like this, with the data it's returning.
[
    {
        "index": "angry",
        ....
    },
    .....
    {
        "index": "dose",
        ......
        "medication": 0.822,
        "dose": 1.0
    }
]
This being returned by this function, using to_dict the pandas method,
return SubstanceTimingBiometric(Expressions,substance,scheduled_medication,emotion).corr().round(3).reset_index().to_dict("records")
I really just want to return one json / dict object, being the index at medication. How would I do this simply?
the example input, and output I suppose,but with sentiment instead of expressions (so not using angry, sad, etc).
it's just in a basic dataframe that looks like this above before re-indexing etc
Did this which fixed it,
expression_dfc[expression_dfc.index=="medication"]
now I want to transform it to be more like a separate format.
i.e.,
const correlation_sentiment= [
  {
      "index": "dose",
      "angry": 0.004,
      "disgusted": 0.002,
      "fearful": 0.008,
      "happy": -0.032,
      "neutral": 0.004,
      "sad": 0.042,
      "surprised": -0.034,
      "medication": 0.822,
      "dose": 1.0
  }
]
const data = [
  {
    emotion: 'angry',
    medication: -.10,
  },
  {
    emotion: 'disgusted',
    medication: .05,
  },
  {
    emotion: 'fearful',
    medication: .35,
  },
  {
    emotion: 'happy',
    medication: .10,
  },
  {
    emotion: 'neutral',
    medication: .220,
  },
  {
    emotion: 'sad',
    medication: .120,
  },
  {
    emotion: 'surprised',
    medication: -.120,
  },
];

 
    