Problem with dicts and zip in Python 3 [duplicate]

0

I am having problems with the dict(zip(x, y)) function when I pass the two lists as a parameter ( x and y ) zip does not create the original size list, randomly creates the list in its original size, but most always between 2 to 5 values less. This supposes for x that has size 100 and y also size 100. Both x and y have the same size. How do I solve this? Many thanks!

    
asked by anonymous 17.07.2016 / 05:31

1 answer

0

Your "x" list is used as a dictionary key: dictionary keys are unique - any repeated value of x will overwrite the previously stored key / value pair.

What's happening is that you have some repeating values in your x list.

As you said no more about the nature of your data, and the expected output is only how far you can respond.

    
17.07.2016 / 19:30