I have a dictionary mapping an id_ to a list of data values like so: dic = {id_ : [v1, v2, v3, v4]}.
I’m trying to iterate through every value in the dictionary and retrieve the max/min of a certain index of the list mappings.
What I want to do is something like this:
maximum = max([data[0], ??) for id_, data in self.dic.items()])
…but obviously this will not work. Is it possible to do this in one line as above?
You need to use it something like this:
since you are not using your
keys, simply usedict.values()to get just the values.