I want find similarity rating between dictionary keys in Python

  data-analysis, dictionary, python, similarity

In python:
I have a dictionary of 1000 products like this:

products={p1:"apples",p2:"oranges",...,p1000:"bananas"}

I now have 20.000 old shopping orders (dictionary) that look like this:

orders={

    "order_1":{"p1":100,"p7":30,...,"p560":126},
    "order_2":{"p6":1300,"p7":51,...,"p423":3000},
     ...,
    "order_20000":{"p1":700,"p4":5,...,"p942":178}
    }

Each order has different number of unique products (100-200 products)

For each order I have the time it took to gather all products:

time={"order1":15days,"order2":34days",...,"order20000":7days}

When I recieve a new order, I want to find the MOST SIMILAR order (or the 5 most similar) from the orders dictionary so I can predict the time I will need to gather the products

ex. I get a new_order={"p3":480,"p14":1800,…,"p780":170}

How much time will I need to gather all the products for this order?

Source: Python Questions

LEAVE A COMMENT