Convert categorical labels into a binary indicator matrix with one column per category, in the order given by categories.
Implement solve(values, categories).
Returns. Return an integer NumPy array of shape (len(values), len(categories)). A label that is not in categories raises KeyError.
Example 1
Input:
solve(['a', 'c', 'b'], ['a', 'b', 'c'])
Output:
[[1, 0, 0], [0, 0, 1], [0, 1, 0]]
Example 2
Input:
solve(['x', 'x'], ['x', 'y'])
Output:
[[1, 0], [1, 0]]
No results yet
Run your code to check it against the examples, or submit to run every test.