Kima
Kima

Reputation: 1

IndexError: list index out of range i have a specific Local Outlier factor problem


IndexError                                Traceback (most recent call last)

in

----> 3 df[ii] = pd.read_csv('/content/CSVs/' + x[ii]).dropna()

ii = 0

df[ii] = pd.read_csv('/content/CSVs/' + x[ii]).dropna()
rf[ii] = RandomForestClassifier(random_state=0)
rf[ii].fit(  df[ii].select_dtypes(exclude=['object']).replace((np.inf, - 
np.inf, np.nan), 0) ,df[ii][' Label'])

f_i[ii] = list(zip(df[ii].columns,rf[ii].feature_importances_))
f_i[ii].sort(key = lambda x : x[1])
plt.barh([x[0] for x in f_i[ii][-20:]],[x[1] for x in f_i[ii][-20:]])
plt.show()

IndexError: list index out of range

This is the code, can someone please help me with this

Upvotes: 0

Views: 47

Answers (0)

Related Questions