Answers for "dictionary in bah remain duplicate keys"

2

switching keys and values in a dictionary in python [duplicate]

my_dict = {2:3, 5:6, 8:9}

new_dict = {}
for k, v in my_dict.items():
    new_dict[v] = k
Posted by: Guest on February-16-2020
0

duplicate entry for key

The error says it all:

Duplicate entry '' 
So run the following query:

SELECT unique_id,COUNT(unique_id)
FROM yourtblname
GROUP BY unique_id
HAVING COUNT(unique_id) >1
This query will also show you the problem

SELECT *
FROM yourtblname
WHERE unique_id=''
This will show you where there are values that have duplicates. You are trying to create a unique index on a field with duplicates. You will need to resolve the duplicate data first then add the index
Posted by: Guest on March-16-2021

Code answers related to "dictionary in bah remain duplicate keys"

Python Answers by Framework

Browse Popular Code Answers by Language