import pandas as pd import numpy as np
df = pd.read_csv('1.csv') # 得到 DataFrame df = np.array(df) # 转换为 ndarray [[1], [2], [3]] df = corpus.reshape(1, len(df)).tolist() # 转换成 List [[1, 2, 3]] df = df[0] # 第一个元素得到最终结果 [1, 2, 3]
import pandas as pd import numpy as np
df = pd.read_csv('1.csv') # 得到 DataFrame df = np.array(df) # 转换为 ndarray [[1], [2], [3]] df = corpus.reshape(1, len(df)).tolist() # 转换成 List [[1, 2, 3]] df = df[0] # 第一个元素得到最终结果 [1, 2, 3]