pandas.DataFrame.values
参考:https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.values.html
作用:返回DataFrame的numpy.ndarray。只有DataFrame中的值将被返回,轴标签将被删除。
import pandas as pd
d1 = [[3,"negative",2],[4,"negative",6],[11,"positive",0],[12,"positive",2]]
df1 = pd.DataFrame(d1, columns=["xuhao","result","value"])
print(df1)
# xuhao result value
# 0 3 negative 2
# 1 4 negative 6
# 2 11 positive 0
# 3 12 positive 2
print(df1.dtypes)
# xuhao int64
# result object
# value int64
# dtype: object
print(df1.values)
# [[3 'negative' 2]
# [4 'negative' 6]
# [11 'positive' 0]
# [12 'positive' 2]]
print(type(df1.values))
# <class 'numpy.ndarray'>