remove duplicate values from items in a dictionary in Python
<p>How can I check and remove duplicate values from items in a dictionary?
I have a large data set so I'm looking for an efficient method. The following is an example of values in a dictionary that contains a duplicate:</p>

<pre><code>'word': [('769817', [6]), ('769819', [4, 10]), ('769819', [4, 10])]
</code></pre>

<p>needs to become </p>

<pre><code>'word': [('769817', [6]), ('769819', [4, 10])]
</code></pre>

<p>You have a list, not a dictionary.  Python dictionaries may have only one value for each key.  Try</p>

<pre><code>my_dict = dict([('769817', [6]), ('769819', [4, 10]), ('769819', [4, 10])])
</code></pre>

<p>result:</p>

<pre><code>{'769817': [6], '769819': [4, 10]}
</code></pre>

<p>a Python dictionary.  For more information <a href="https://docs.python.org/3/tutorial/datastructures.html#dictionaries" rel="nofollow">https://docs.python.org/3/tutorial/datastructures.html#dictionaries</a></p>

python dictionary