Home > Blockchain >  How do i extract the contents of a numpy array to a list?
How do i extract the contents of a numpy array to a list?

Time:10-06

I have the following numpy array..

In[48]: idx
Out[48]: (array([223, 226, 445, 494, 546, 696, 702, 713, 725, 749], dtype=int64),)

Can anyone tell me how I convert this into a list or another dataframe? I've tried the tolist() function but it doesn't work, it gives the error ''tuple' object has no attribute 'tolist'

CodePudding user response:

Try idx[0].tolist(), your array is encapsulated in a tuple.

  • Related