I have a numpy array that looks like the following:
np.array([
[23, 12, 4, 103, 87, 0.6],
[32, 18, 3, 120, 70, 0.6],
[43, 12, 8, 109, 89, 0.4],
[20, 13, 7, 111, 77, 0.8]
])
I want to transform this array where the last column becomes its own array, such that it will look like this:
np.array([
[[23, 12, 4, 103, 87], [0.6]],
[[32, 18, 3, 120, 70], [0.6]],
[[43, 12, 8, 109, 89], [0.4]],
[[20, 13, 7, 111, 77], [0.8]]
])
What would be the best way to go about this? I am relatively new to Python and have tried out some loops but to no avail. Thanks!