Scaling continuous data to discrete range
Update Accordingly: Your question was not clear before, therefore, sorry for the irrelevant solution.
To achieve that, I don't think there is a public library function, however, you can build your solution using some beautiful &quot;ready&quot; functions.
Two solutions come into my mind:

First one's time complexity is O(N*M)

N is your prediction (list a in your case) size, and M is your dictionary (list b in your case) size.
import numpy as np

def findClosest(dictionary, value):
    idx = (np.abs(dictionary - value)).argmin()
    return dictionary[idx]

#[findClosest(b, elem) for elem in a] 

print([findClosest(b, elem) for elem in a])

This just subtracts your prediction value from the values in your dictionary and takes the absolute value of them. Then in the resulting array, it looks for the location of value that is smallest.

Second one's time complexity is O(N*log(M))

N and M denote the same thing as the first solution.
from bisect import bisect_left
def findClosestBinary(myList, myNumber):
    pos = bisect_left(myList, myNumber)
    if pos == 0:
        return myList[0]
    if pos == len(myList):
        return myList[-1]
    before = myList[pos - 1]
    after = myList[pos]
    if after - myNumber &lt; myNumber - before:
        return after
    else:
        return before

#[findClosestBinary(b, elem) for elem in a] 

print([findClosestBinary(b, elem) for elem in a])

Note: To save time I didn't implement myself but took the findClosestBinary() function from here.
This one is a better algorithmic approach in terms of time complexity. This does the same thing but uses a binary search to efficiently find the closest value in the dictionary.  However, it assumes your dictionary (list b) is sorted. Since your dictionary is a predefined list, you can improve the performance by providing a sorted array.
However, if your dictionary that you will map predictions to is not a very big one, then you can just use the first one. In the case of the dictionary being small, these two functions will behave the same in terms of time.