start = [(1,2),(3,4),(1,3),(3,5)]
How to add values of y tuples if x values are equally efficient (I work with 700,000 tuples)?
end = [(1,5),(3,9)]
What am I trying:
I am trying to convert my list of tuples to a list of individual dictionaries. However, this does not seem to me the most effective method.
However, then I cannot figure out how to convert the list of tuples into a list of individual dictionaries.
I tried dict (start) and this:
a = []
for lv in length_view:
a.append(dict(lv))
How can i do this?
And then I will try to use:
from collections import Counter
c = Counter()
for some_dictionary in some_list:
c.update(some_dictionary)
[{key: value} for key, value in c.items()]
source
share