0

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.

2

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0
arr = np.array([1, 2, 3])
print(f'NumPy Array:\n{arr}')

list1 = arr.tolist()
print(f'List: {list1}')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.