Reputation: 103
I have the following np.array: {0: array([[254, 426],...54, 426]])}
and would like this as desired output: [(444, 703), (623, 543), (691, 177), (581, 26), (482, 42)]
How can I do this? I need the variable to be set like in the desired output.
Thanks a lot.
Upvotes: 0
Views: 84
Reputation: 15
arr = np.array([1, 2, 3])
print(f'NumPy Array:\n{arr}')
list1 = arr.tolist()
print(f'List: {list1}')
Upvotes: 0
Reputation: 369
As it is mentioned in the comments that is not an array but a dictionary. can get list of tuples buy doing this:
list(map(tuple, dict[0]))
where dict is your dictionary
Upvotes: 1