I currently have a list of numpy arrays. These arrays contain sets of 2D points. I'd like to iterate over each array in this list as depending on the contents of the array two scenarios can occur. The issue I'm running into is that when I try to iterate over the list like so:
for array in list:
it iterates over entries in the arrays as opposed to iterating over the arrays themselves. For example:
a = [array([[[1, 2]], [[3, 4]]], dtype=int32), array([[[5, 6]], [[7, 8)]]], dtype=int32)]
for array in a:
print(array)
yields
1
2
3
4
5
6
7
8
when I'm expecting to get
[[1, 2], [3, 4]]
[[5, 6], [7, 8]]
fromnp, especially if you're going to want to use them for other variables. Writingfor array in a:in your sample makesarraystop referring to the Numpy type and will mess up subsequent code.