本文簡要介紹 python 語言中 numpy.dsplit
的用法。
用法:
numpy.dsplit(ary, indices_or_sections)
沿第 3 軸(深度)將數組拆分為多個子數組。
請參閱
split
文檔。dsplit
相當於split
和axis=2
,隻要數組維度大於或等於 3,數組始終沿第三軸分割。例子:
>>> x = np.arange(16.0).reshape(2, 2, 4) >>> x array([[[ 0., 1., 2., 3.], [ 4., 5., 6., 7.]], [[ 8., 9., 10., 11.], [12., 13., 14., 15.]]]) >>> np.dsplit(x, 2) [array([[[ 0., 1.], [ 4., 5.]], [[ 8., 9.], [12., 13.]]]), array([[[ 2., 3.], [ 6., 7.]], [[10., 11.], [14., 15.]]])] >>> np.dsplit(x, np.array([3, 6])) [array([[[ 0., 1., 2.], [ 4., 5., 6.]], [[ 8., 9., 10.], [12., 13., 14.]]]), array([[[ 3.], [ 7.]], [[11.], [15.]]]), array([], shape=(2, 2, 0), dtype=float64)]
相關用法
- Python numpy dstack用法及代碼示例
- Python numpy dtype.isbuiltin用法及代碼示例
- Python numpy dtype.shape用法及代碼示例
- Python numpy dtype.ndim用法及代碼示例
- Python numpy dtype.alignment用法及代碼示例
- Python numpy diagonal用法及代碼示例
- Python numpy dtype用法及代碼示例
- Python numpy dtype.names用法及代碼示例
- Python numpy dtype.__class_getitem__用法及代碼示例
- Python numpy divmod用法及代碼示例
- Python numpy dtype.flags用法及代碼示例
- Python numpy diagflat用法及代碼示例
- Python numpy dtype.fields用法及代碼示例
- Python numpy dtype.subdtype用法及代碼示例
- Python numpy delete用法及代碼示例
- Python numpy dtype.descr用法及代碼示例
- Python numpy dec.setastest用法及代碼示例
- Python numpy datetime_as_string用法及代碼示例
- Python numpy divide用法及代碼示例
- Python numpy dtype.kind用法及代碼示例
- Python numpy dtype.metadata用法及代碼示例
- Python numpy diag用法及代碼示例
- Python numpy dec.slow用法及代碼示例
- Python numpy dtype.newbyteorder用法及代碼示例
- Python numpy digitize用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.dsplit。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。