The code below is giving me nearly the output i want but not quite.
def reducer(self, year, words):
x = Counter(words)
most_common = x.most_common(3)
sorted(x, key=x.get, reverse=True)
yield (year, most_common)
This is giving me output
"2020" [["coronavirus",4],["economy",2],["china",2]]
What I would like it to give me is
"2020" "coronavirus china economy"
If someone could explain to me why i am getting a list of lists instead of the output i require I would be most grateful. Along with an idea on how to improve the code to get what I need.