Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Reshaping and Stacking | Getting into NumPy Basics
Getting into NumPy Basics
course content

Contenido del Curso

Getting into NumPy Basics

bookReshaping and Stacking

Reshaping and stacking NumPy arrays involve modifying the shape or size of an array or amalgamating multiple arrays into a single array. NumPy offers a variety of functions for these purposes, such as:

  • reshape(): Alters an array to a new shape without changing its data;
  • resize(): Changes an array's size to a new shape, which can lead to the addition or removal of elements;
  • vstack(): Vertically stacks arrays (row-wise) to form a single array;
  • hstack(): Horizontally stacks arrays (column-wise) to create a single array;
  • concatenate(): Joins arrays along a specified axis;
  • stack(): Layers arrays along a new axis, adding a dimension.

Tarea

  1. Reshape the arr array to a new configuration.
  2. Resize the arr array to a new dimension, possibly adding or omitting elements.
  3. Vertically stack all the arrays to produce a unified array (in the order of creation).
  4. Horizontally stack all the arrays to form a single array (in the order of creation).

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Reshaping and stacking NumPy arrays involve modifying the shape or size of an array or amalgamating multiple arrays into a single array. NumPy offers a variety of functions for these purposes, such as:

  • reshape(): Alters an array to a new shape without changing its data;
  • resize(): Changes an array's size to a new shape, which can lead to the addition or removal of elements;
  • vstack(): Vertically stacks arrays (row-wise) to form a single array;
  • hstack(): Horizontally stacks arrays (column-wise) to create a single array;
  • concatenate(): Joins arrays along a specified axis;
  • stack(): Layers arrays along a new axis, adding a dimension.

Tarea

  1. Reshape the arr array to a new configuration.
  2. Resize the arr array to a new dimension, possibly adding or omitting elements.
  3. Vertically stack all the arrays to produce a unified array (in the order of creation).
  4. Horizontally stack all the arrays to form a single array (in the order of creation).

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 6
some-alt