Python multiprocessing - Return a dict
<p>I'd like to parallelize a function that returns a flatten list of values (called "keys") in a dict but I don't understand how to obtain in the final result. I have tried:</p>

<pre><code>def toParallel(ht, token):
    keys = []
    words = token[token['hashtag'] == ht]['word']
    for w in words:
        keys.append(checkString(w))
    y = {ht:keys}

num_cores = multiprocessing.cpu_count()
pool = multiprocessing.Pool(num_cores)

token = pd.read_csv('/path', sep=",", header = None, encoding='utf-8')
token.columns = ['word', 'hashtag', 'count']
hashtag = pd.DataFrame(token.groupby(by='hashtag', as_index=False).count()['hashtag'])

result = pd.DataFrame(index = hashtag['hashtag'], columns = range(0, 21))
result = result.fillna(0)

final_result = []
final_result = [pool.apply_async(toParallel, args=(ht,token,)) for ht in hashtag['hashtag']]
</code></pre>

<p>Where toParallel function should return a dict with hashtag as key and a list of keys (where keys are int). But if I try to print final_result, I obtain only </p>

<blockquote>
  <p>bound method ApplyResult.get of multiprocessing.pool.ApplyResult object at 0x10c4fa950</p>
</blockquote>

<p>How can I do it?</p>