my_list=[[123.45][34.23][123.98][67]]
The type of my_list is <class 'numpy.ndarray'> I need to add a new numpy.ndarray to the existing my_list.
new=[34.6]
Expected output:
my_list=[[123.45][34.23][123.98][67][34.6]]
please check concatenate
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
# Append array arr2 to array arr1
c = np.concatenate((arr1, arr2))
print(c)
you can try this
np.append(my_list, new)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.