Skip to content

Commit e2ec0b3

Browse files
authored
Minor correction in advanced-indexing.ipynb (#318)
The product described here is the Cartesian product, not a cross product
1 parent 378a745 commit e2ec0b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

intermediate/indexing/advanced-indexing.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"source": [
9999
"**Pointwise** or **Vectorized indexing**, shown on the left, selects specific elements at given coordinates, resulting in an array of those individual elements. In the example shown, the indices `[0, 2, 4]`, `[0, 2, 4]` select the elements at positions `(0, 0)`, `(2, 2)`, and `(4, 4)`, resulting in the values `[1, 13, 25]`. This is the default behavior of NumPy arrays.\n",
100100
" \n",
101-
"In contrast, **orthogonal indexing** uses the same indices to select entire rows and columns, forming a cross-product of the specified indices. This method results in sub-arrays that include all combinations of the selected rows and columns. The example demonstrates this by selecting rows 0, 2, and 4 and columns 0, 2, and 4, resulting in a subarray containing `[[1, 3, 5], [11, 13, 15], [21, 23, 25]]`. This is Xarray DataArray's default behavior.\n",
101+
"In contrast, **orthogonal indexing** uses the same indices to select entire rows and columns, forming the Cartesian product of the specified indices. This method results in sub-arrays that include all combinations of the selected rows and columns. The example demonstrates this by selecting rows 0, 2, and 4 and columns 0, 2, and 4, resulting in a subarray containing `[[1, 3, 5], [11, 13, 15], [21, 23, 25]]`. This is Xarray DataArray's default behavior.\n",
102102
" \n",
103103
"The output of vectorized indexing is a `1D array`, while the output of orthogonal indexing is a `3x3` array. \n",
104104
"\n",

0 commit comments

Comments
 (0)