adding info on the required Numpy version to the recenlty added solution
This commit is contained in:
@@ -1436,7 +1436,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"A = np.random.randint(0,10,(3,4,3,4))\n",
|
"A = np.random.randint(0,10,(3,4,3,4))\n",
|
||||||
"# solution by passing a tuple of axes\n",
|
"# solution by passing a tuple of axes (introduced in numpy 1.7.0)\n",
|
||||||
"sum = A.sum(axis=(-2,-1))\n",
|
"sum = A.sum(axis=(-2,-1))\n",
|
||||||
"print(sum)\n",
|
"print(sum)\n",
|
||||||
"# solution by flattening the last two dimensions into one\n",
|
"# solution by flattening the last two dimensions into one\n",
|
||||||
|
|||||||
@@ -693,7 +693,7 @@ print(np.unique(I))
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
A = np.random.randint(0,10,(3,4,3,4))
|
A = np.random.randint(0,10,(3,4,3,4))
|
||||||
# solution by passing a tuple of axes
|
# solution by passing a tuple of axes (introduced in numpy 1.7.0)
|
||||||
sum = A.sum(axis=(-2,-1))
|
sum = A.sum(axis=(-2,-1))
|
||||||
print(sum)
|
print(sum)
|
||||||
# solution by flattening the last two dimensions into one
|
# solution by flattening the last two dimensions into one
|
||||||
|
|||||||
Reference in New Issue
Block a user