this is my code.
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(random_state=111)
dbscan.fit(data3)
data3 is a pandas dataframe:
FAC1_2 FAC2_2
0 -0.227252 -0.685482
1 0.015251 -0.988252
2 -0.291176 -0.696146
3 -0.747702 -0.708030
4 -0.648103 -0.701741
5 -0.546777 -0.906151
6 -0.141553 -0.689223
7 0.159203 -0.734537
8 0.345847 -0.900163
9 -0.049349 -0.700356
10 0.079924 -0.651371
I get the following error:
File "/anaconda/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py", line 1632, in _maybe_convert_indices
raise IndexError("indices are out-of-bounds")
IndexError: indices are out-of-bounds
What is the problem?
the problem was a bug. It doesn't work with pandas dataframe. The solution is to convert the pandas dataframe into a numpy array:
data3 = np.array(data3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With