Answers for "tuple to np array"

0

convert tuple to array python

import numpy 

my_tuple = ([8, 4, 6], [1, 2, 3])
print("Tuple to array: ")
print(numpy.asarray(my_tuple))
Posted by: Guest on January-27-2021
1

np to tuple

tuple(arr)
Posted by: Guest on March-10-2021
2

numpy array from list

>>> a = [1, 2]
>>> np.asarray(a)
array([1, 2])
Posted by: Guest on September-21-2020
0

np array to tuple

>>> arr = numpy.array(((2,2),(2,-2)))
>>> tuple(map(tuple, arr))
((2, 2), (2, -2))
Posted by: Guest on September-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language