list转换nparray
import numpy as np
list1 = []; #新建一个空的list
list1.append('hello')
list1.append('world')
list1.append('!')
print(list1)
print(type(list1))
array1 = np.array(list1)
print(array1)
print(type(array1))
nparray转换list
list2 = array1.tolist()
print(list2)
print(type(list2))
pandas转换nparray
dataframe = pd.read_csv('data.csv')#需要在文件夹中有一个data.csv的文件
array2 = dataframe.values
nparray转换pandas
import pandas as pd
df = pd.DataFrame(array1)
#print(df)
#print(type(df))
来源:https://blog.csdn.net/u013318356/article/details/79883306