I have a numpy ndarray in this form:
inputs = np.array([[1],[2],[3]])
How can I convert this ndarray
to a deque
(collections.deque
) so that the structure get preserved (array of arrays) and I could apply normal deque methods such as popleft()
and append()
? for example:
inputs.popleft()
->>> [[2],[3]]
inputs.append([4])
->>> [[2],[3], [4]]
Hmm I think that you can do:
inputs = np.array([[1],[2],[3]])
inputs = collections.deque([list(i) for i in inputs])
inputs.append([4])
inputs.popleft()
EDIT. I edited code