How can I remove the double square brackets of a numpy array to single square brackets like a list?
[[0, 3.49, 0, 4.55]]
desired output
[0,3.49,0,4.55]
I have searched through SO looking for numpy array to list , square brackets numpy, not being able to find an answer
to_list()
only add commas among the values
如果它们被编码为列表,则只需使用[0]
元素
Are you sure it was a numpy array?
I think just use
my_list[0]
to get the first element (in the first element is [0,3.49,0,4.55]
)
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.