I am building a table from an API data, so I need to iterate by the required metrics one by one to get this information. So my output should look something like this:
[
{"d1":"dvalue", "d2":"dvalue", "d3":"dvalue",..., "m1":"value", "m2":"value", "m3":"value",...},
{"d1":"dvalue2", "d2":"dvalue2", "d3":"dvalue2",..., "m1":"value2", "m2":"value2", "m3":"value2",...},
...
]
But, as said, I need to iterate over mX for all the dX, one by one.
I was thinking in using pandas dataframe, but read about inserting a lot of values from scratch is not the best idea.
So what's on my mind right now, is using a defaultdict of type dict using tuples as keys, so it would look something like this:
{
("dvalue", "dvalue", "dvalue",...) : {"m1":"value", "m2":"value", "m3":"value",...},
("dvalue2", "dvalue2", "dvalue2",...) : {"m1":"value2", "m2":"value2", "m3":"value2",...},
...
}
So I think that over iterations would be easier to find where to insert the mx value. But I have no clue about how to pass from this structure to the required output.
Thank you in advance, guys!