From f13dc12ab02509016683d9aa38452b21020f2e7a Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:23:49 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- numpy/mesh_grid/README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/numpy/mesh_grid/README.md b/numpy/mesh_grid/README.md index 65d123a..082adb1 100644 --- a/numpy/mesh_grid/README.md +++ b/numpy/mesh_grid/README.md @@ -258,3 +258,38 @@ plt.show() **Note the matrix multiplication @** ![image5](image5.png) + +## [numpy.indices](https://numpy.org/doc/stable/reference/generated/numpy.indices.html) + +{: .topic-optional} +This is an optional topic! + +```python +numpy.indices(dimensions, dtype=, sparse=False) +``` + +> Return an array representing the indices of a grid. +> +> Compute an array where the subarrays contain index values 0, 1, … varying only along the corresponding axis. + +```python +import numpy as np + +a, b = np.indices((3,4)) + +print(a) +print() +print(b) +``` + +Output: + +```python +[[0 0 0 0] + [1 1 1 1] + [2 2 2 2]] + +[[0 1 2 3] + [0 1 2 3] + [0 1 2 3]] +```