Q:

Drop dict entries with the lowest values

In the following dict how can I drop the two entries with the lowest values?
{('F2', 'F1'): 0.9154929577464789,
 ('F2', 'F3'): 0.8285714285714286,
 ('F4', 'F1'): 0.8285714285714286,
 ('F4', 'F3'): 0.9130434782608695}

A:

One way to approach the problem would be to sort by the values and slice the first two items:
In [1]: data = {('F2', 'F1'): 0.9154929577464789,
    ...:        ('F2', 'F3'): 0.8285714285714286,
    ...:        ('F4', 'F1'): 0.8285714285714286,
    ...:        ('F4', 'F3'): 0.9130434782608695}

In [2]: from operator import itemgetter

In [3]: dict(sorted(data.items(), key=itemgetter(1))[2:])
Out[3]: {('F2', 'F1'): 0.9154929577464789, ('F4', 'F3'): 0.9130434782608695}

One potential problem could be that, if you would have more than 2 items with the same lowest value, we'll slice only 2 of them, not all of them. 

Or, we can use heapq (implements the "minimum heap" data structure) to find the n smallest items and filter them from our dictionary:
In [4]: import heapq

In [5]: smallest = set(heapq.nsmallest(2, data, key=data.get))

In [6]: {key: value for key, value in data.items() if key not in smallest}
Out[7]: {('F2', 'F1'): 0.9154929577464789, ('F4', 'F3'): 0.9130434782608695} 

