|
|
发表于 2022-10-22 10:03:11
|
显示全部楼层
本楼为最佳答案
本帖最后由 suchocolate 于 2022-10-22 10:04 编辑
- print(help(np.ndarray))
- Help on class ndarray in module numpy:
- class ndarray(builtins.object)
- | ndarray(shape, dtype=float, buffer=None, offset=0,
- | strides=None, order=None)
- |
- | An array object represents a multidimensional, homogeneous array
- | of fixed-size items. An associated data-type object describes the
- | format of each element in the array (its byte-order, how many bytes it
- | occupies in memory, whether it is an integer, a floating point number,
- | or something else, etc.)
- |
- | Arrays should be constructed using `array`, `zeros` or `empty` (refer
- | to the See Also section below). The parameters given here refer to
- | a low-level method (`ndarray(...)`) for instantiating an array.
- |
- | For more information, refer to the `numpy` module and examine the
- | methods and attributes of an array.
- |
- | Parameters
- | ----------
- | (for the __new__ method; see Notes below)
- |
- | shape : tuple of ints
- | Shape of created array.
复制代码
shape需要用元祖形式传入:
- data1= np.ndarray((n_samples,n_features))
复制代码 |
|