from:http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.as_matrix.html
DataFrame.
as_matrix
(
columns=None
)
[source]
Convert the frame to its Numpy-array representation.
| Parameters: | columns: list, optional, default:None
|
|---|---|
| Returns: | values : ndarray
|
See also
Notes
Return is NOT a Numpy-matrix, rather, a Numpy-array.
The dtype will be a lower-common-denominator dtype (implicit upcasting); that is to say if the dtypes (even of numeric types) are mixed, the one that accommodates all will be chosen. Use this with care if you are not dealing with the blocks.
e.g. If the dtypes are float16 and float32, dtype will be upcast to float32. If dtypes are int32 and uint8, dtype will be upcase to int32. By numpy.find_common_type convention, mixing int64 and uint64 will result in a flot64 dtype.
This method is provided for backwards compatibility. Generally, it is recommended to use ‘.values’.
Pandas DataFrame.as_matrix 方法详解
本文详细介绍了 Pandas 库中 DataFrame 类的 as_matrix 方法,该方法用于将 DataFrame 转换为 Numpy 数组形式。文章解释了方法的工作原理、参数设置以及返回值类型,并对比了与其他类似方法的区别。
1290

被折叠的 条评论
为什么被折叠?



