#remove stocks with 0 mentions stock_with_mentions = dict((k, v) for k, v in stocks.items() if v >= 50) #sort by value sorted_stocks = {k: v for k, v in sorted(stock_