Merge pull request #44 from silverriver/silver_dev

typo in 59 and changed solution of 66
This commit is contained in:
Nicolas P. Rougier 2017-04-04 21:46:37 +02:00 committed by GitHub
commit f440691a50
2 changed files with 6 additions and 4 deletions

View File

@ -1015,7 +1015,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 59. How to I sort an array by the nth column? (★★☆)"
"#### 59. How to sort an array by the nth column? (★★☆)"
]
},
{

View File

@ -1243,7 +1243,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 59. How to I sort an array by the nth column? (★★☆)"
"#### 59. How to sort an array by the nth column? (★★☆)"
]
},
{
@ -1423,9 +1423,11 @@
"\n",
"w,h = 16,16\n",
"I = np.random.randint(0,2,(h,w,3)).astype(np.ubyte)\n",
"F = I[...,0]*256*256 + I[...,1]*256 +I[...,2]\n",
"#Note that we should compute 256*256 first. \n",
"#Otherwise numpy will only promote F.dtype to 'uint16' and overfolw will occur\n",
"F = I[...,0]*(256*256) + I[...,1]*256 +I[...,2]\n",
"n = len(np.unique(F))\n",
"print(np.unique(I))"
"print(n)"
]
},
{