Update 100_Numpy_exercises_with_solutions.md

This commit is contained in:
artfintl 2021-02-18 16:09:04 +08:00 committed by GitHub
parent b38b0c2889
commit fb03972f0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -682,6 +682,7 @@ print(F)
w,h = 16,16
I = np.random.randint(0,2,(h,w,3)).astype(np.ubyte)
# The parenthesis around 256*256 ensure the dtpye promoted to uint32 properly.Otherwise the first term will overflow.
F = I[...,0]*(256*256) + I[...,1]*256 +I[...,2]
n = len(np.unique(F))
print(np.unique(I))