How to convert array into special items of structured array and revert it back?
问题 I want to perform some numpy methods on items of structured array instead of numbers. So, for example, while working with array of integers of shape (4, 3), I need to convert it to array of items of length 3 and perform some operations as it were a single one dimensional array of shape (4,). These conversions itself, unfortunately, looks really complicated for me. Let's take another example: n, m, r = 2, 3, 4 array = np.arange(n*m).reshape((n,m)) dt = np.dtype(','.join('i'*m)) arr1 = np.array