I'm trying to format my dataset so it can be used by danfjo.js which is formatted as the following
json_data = [{ A: 0.4612, B: 4.28283, C: -1.509, D: -1.1352 },
{ A: 0.5112, B: -0.22863, C: -3.39059, D: 1.1632 },
{ A: 0.6911, B: -0.82863, C: -1.5059, D: 2.1352 },
{ A: 0.4692, B: -1.28863, C: 4.5059, D: 4.1632 }]
df = new dfd.DataFrame(json_data)
df.print()
My POST request sends back a dataframe in the following form.
data
'A' : {0:'0.4612', 1:'0.5112',...
'B' : {0:'4.28283', 1:'-0.22863', ...
I'm unfamilar with the javascript language. What term would you use for this reshape and how would you go about it?
The API POST data provided in the question is invalid as well as incomplete. It could be either an object or an array of objects or something else. In either of the two cases (first being
formB
, and second beingformC
in the snippet below), the code will generate an array (which matches the array being assigned to the variablejson_data
in the question abouve) when user presses"y"
at the prompt.