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.

Celius Stingher
18.4k6 gold badges26 silver badges54 bronze badges
asked Sep 4, 2019 at 13:33
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

answered Sep 4, 2019 at 14:18
0
0
arr = np.array([1, 2, 3])
print(f'NumPy Array:\n{arr}')
list1 = arr.tolist()
print(f'List: {list1}')
answered Mar 5, 2020 at 12:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.