Python Forum
RandomForestClassifier IndexingError: Too many indexers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RandomForestClassifier IndexingError: Too many indexers
#1
Dear Python Experts,

I have googled this error but just came to new ways of slicing the data frame what led to near error (invalid slice).
What does that exactly mean to many indexers and why does that happen when I only slice 1:3?

from sklearn.ensemble import RandomForestClassifier
#---Random Forest Classifier
clf = RandomForestClassifier(max_features = 8, random_state = 0)
clf.fit(X_train1.ix[1:,3], y_train1.ix[1:,3])
clf_predicted = clf.predict(X_test)
Reply
#2
Does someone know why this is happening?
Reply
#3
If that is all your code. What is your variable X_train1.ix and y_train1.ix? try printing those variable to see if it exist.
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020