python:list与numpy的切换

1、list切换成numpy

import numpy as np

a_list= [[1, 2, 3], 4, 5, 6]]
a_np = np.array(a_list)

2、numpy切换成list

import numpy as np

a_np= np.array([[1, 2, 3], 4, 5, 6]])
a_list = a_np.tolist(a_np)

你可能感兴趣的:(python,python,numpy,开发语言)