mubaris / friendly-fortnight

:wolf: K-Means Clustering using Python from Scratch :mushroom:
https://mubaris.com/2017-10-01/kmeans-clustering-in-python
128 stars 242 forks source link

numpy error #1

Open saifabuhashish opened 6 years ago

saifabuhashish commented 6 years ago

When I run the code with my own csv file, I get the following error: Traceback (most recent call last): File "kmeans.py", line 32, in C_x = np.random.randint(0, np.max(X), size=k) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 2320, in amax out=out, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/_methods.py", line 26, in _amax return umr_maximum(a, axis, None, out, keepdims) TypeError: cannot perform reduce with flexible type

Any idea what might be going on?

jangho2001us commented 6 years ago

I think it may come from the type of the variable...