.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python_packages\numpy\demo_splitting.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_packages_numpy_demo_splitting.py: Splitting array ================== .. GENERATED FROM PYTHON SOURCE LINES 4-8 .. code-block:: Python import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 10-14 .. code-block:: Python rg = np.random.default_rng(1) a = np.floor(10 * rg.random((2, 12))) a .. rst-class:: sphx-glr-script-out .. code-block:: none array([[5., 9., 1., 9., 3., 4., 8., 4., 5., 0., 7., 5.], [3., 7., 3., 4., 1., 4., 2., 2., 7., 2., 4., 9.]]) .. GENERATED FROM PYTHON SOURCE LINES 15-18 .. code-block:: Python b = np.hsplit(a, 3) b .. rst-class:: sphx-glr-script-out .. code-block:: none [array([[5., 9., 1., 9.], [3., 7., 3., 4.]]), array([[3., 4., 8., 4.], [1., 4., 2., 2.]]), array([[5., 0., 7., 5.], [7., 2., 4., 9.]])] .. GENERATED FROM PYTHON SOURCE LINES 19-21 .. code-block:: Python c = np.hsplit(a, (3, 4)) c .. rst-class:: sphx-glr-script-out .. code-block:: none [array([[5., 9., 1.], [3., 7., 3.]]), array([[9.], [4.]]), array([[3., 4., 8., 4., 5., 0., 7., 5.], [1., 4., 2., 2., 7., 2., 4., 9.]])] .. _sphx_glr_download_11_demos_python_packages_numpy_demo_splitting.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_splitting.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_splitting.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_splitting.zip `