Merge pull request #44 from silverriver/silver_dev
typo in 59 and changed solution of 66
This commit is contained in:
commit
f440691a50
@ -1015,7 +1015,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"#### 59. How to I sort an array by the nth column? (★★☆)"
|
"#### 59. How to sort an array by the nth column? (★★☆)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1243,7 +1243,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"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",
|
"\n",
|
||||||
"w,h = 16,16\n",
|
"w,h = 16,16\n",
|
||||||
"I = np.random.randint(0,2,(h,w,3)).astype(np.ubyte)\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",
|
"n = len(np.unique(F))\n",
|
||||||
"print(np.unique(I))"
|
"print(n)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user