How can I update my Q-table in Python?
Just try returning a function that takes the state as an input and returns the probabilities for each action in the form of a numpy array of length of the action space (set of possible actions). Here, is one attempt:
def EpsilonGreedyPolicy(Q, epsilon, no_of_actions):

    def policy(state): 
        probabilities = np.ones(no_of_actions, dtype = float) * 
                    epsilon / num_actions 
        best_action = np.argmax(Q[state]) 
        probabilities[best_action] += (1.0 - epsilon) 
        return probabilities 
   
    return policy