Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python remove dtype and the end of an array and get list of lists

Tags:

python

Does any one know how to convert this array into a python list, my ultimate result should be [[1,2,3],[4,6,8]] . Any suggestion would be greatly appreciated.

import numpy as np
from numpy import*


a = [array([  1,   2,   3], dtype=int16), array([4, 6, 8], 
    dtype=int16)]
like image 551
hima Fernando Avatar asked Dec 12 '25 06:12

hima Fernando


1 Answers

Simply use Numpys tolist function.

np.array(a).tolist()

like image 136
Colin Dickie Avatar answered Dec 14 '25 18:12

Colin Dickie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!