In [1]:
import numpy as np
In [2]:
arr1 = np.array(((1,0.1),(3,-0.3),(7,-0.7)))
print(arr1)
In [3]:
arr2 = tuple(map(tuple, arr1))
print(arr2)
In [4]:
def totuple(a):
try:
return tuple(totuple(i) for i in a)
except TypeError:
return a
In [5]:
array1 = np.array(((1,0.1),(3,-0.3),(7,-0.7)))
array2 = totuple(array1)
In [6]:
print(array1)
In [7]:
print(array2)