'How do assign a specific part of a Numpy array?

This is what I want to do:

a = [[1, 2],[3,4]]
b = np.zeros(shape = (2,2))
b[:, 1:] = a[:,1:]

But I get this error message:

TypeError: list indices must be integers or slices, not tuple



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source