I need to pass only values from list of dictionaries to a function. The list of dictionaries looks like this
[ { "positive" : 515, "neutral" : 22, "negative": 1515 },
{ "positive": 15555, "neutral": 2525, "negative": 111}
......
]
and I need to get all the numbers for one key into a list so I can pass it to this function (below). (it shouldn't look like this, this is the only solution I was capable of). I need some more efficient solution, maybe something with map function or list comprehensions, but I have no idea how to use these.
bar_chart.add('neutral', [ dictList[0]['neutral'],dictList[1]['neutral'],dictList[2]['neutral'] ....... ['neutral'],dictList[23]['neutral'] ] )
bar_chart.add('positive', [ dictList[0]['positive'],dictList[1]['positive'],dictList[2]['positive'], ......... ,dictList[23]['positive'] ] )