Pandas Dataframe to_dict() with unique column values as keys
<pre><code>df = pd.DataFrame({'A': ['jars', 'used'], 'B': ['Phrase', 'Phrase']})

      A       B
0  jars  Phrase
1  used  Phrase
</code></pre>

<p>Desired Output:</p>

<pre><code>{'Phrase': ['jars', 'used']}
</code></pre>

<p>If column <code>B</code> has multiple unique values (say: Unique values were <code>Broad</code>, <code>Phrase</code> and <code>Exact</code>):</p>

<pre><code>{'Phrase': ['jars', 'used'], 'Exact': ['val1', 'val2'], 'Broad': ['cat', 'dog']}
</code></pre>

<p>I was thinking something like this but <code>A</code> is the key.</p>

<pre><code>df.set_index('B').to_dict('list')

{'A': ['jars', 'used']}
</code></pre>

<p>I've tried:</p>

<pre><code>&gt;&gt;&gt; dict([(b,[a]) for b, a in zip(df.B, df.A)])
{'Phrase': ['used']}

&gt;&gt;&gt; [{b:[a]} for b, a in zip(df.B, df.A)]
[{'Phrase': ['jars']}, {'Phrase': ['used']}]

&gt;&gt;&gt; df.set_index('B').T.to_dict('list')
{'Phrase': ['used']}
</code></pre>

<p>This is probably stupid-simple.</p>