DataFrame.to_numpyParametersExample DataFrame.to_numpyDataFrame.to_numpy(dtype=None, copy=False, na_value=)将DataFrame转换为NumPy数组。 Parameters dtype 要传递给 numpy.asarray() 的dtype copy False:并不能确保to_numpy()是非复制的;True:确保制作副本 na_value 用于缺失值的值 Exampleimport pandas as pddf = pd.DataFrame({'site':['google', 'baidu', 'wiki', 'pandas'], 'age':[18, 39, 22, 45], 'price': [1.0, 2.0, 3.0, 4.0], 'color': ['red', 'black', None, 'red']}, index=['first', 'second', 'third', 'forth'])df.to_numpy()------------------------------------------------------array([['google', 18, 1.0, 'red'], ['baidu', 39, 2.0, 'black'], ['wiki', 22, 3.0, None], ['pandas', 45, 4.0, 'red']], dtype=object)