Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'int' object is not subscriptable #313

Open
kevlariii opened this issue Dec 13, 2023 · 3 comments
Open

TypeError: 'int' object is not subscriptable #313

kevlariii opened this issue Dec 13, 2023 · 3 comments

Comments

@kevlariii
Copy link

I successfully imported dtreeviz with the command:
from dtreeviz import *

I tried this command:
viz = dtreeviz(clf, xdev, ydev, target_name="isFraud", feature_names = list(xdev.columns), class_names = ['notFraud', 'isFraud'])

I get the error:
TypeError: 'int' object is not subscriptable

Here are my xdev and ydev:
xtrain

image

Any idea on where this error might be coming from?
Thank you so much!

@LegalWiggle
Copy link

Having the same issue as you, did you manage to resolve it?

@tlapusan
Copy link
Collaborator

tlapusan commented Jan 18, 2024

@kevlariii I see that you are using the old API of the library, could you try with the new version ? You can find examples here : https://github.com/parrt/dtreeviz/tree/master/notebooks

If the error still persists, would be very helpful if you could prepare a sharable notebook (like google colab) to investigate the issue. Thanks.

@LegalWiggle if you could provide one also, would be great.

@Leci37
Copy link

Leci37 commented Feb 14, 2024

@kevlariii @LegalWiggle Just add dtreeviz .model(

from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
import dtreeviz
print(dtreeviz.__version__)
#---------------------
    viz = dtreeviz.model(regr_TreeClassifier_model,
                   X_train,  # pandas.DataFrame
                   y_train,  # pandas.Series
                   target_name=Y_TARGET,
                   feature_names=list(X_train.columns)  ) 
    viz.view(scale=0.8)

@tlapusan this kind import from dtreeviz import * could generate errors like this ticket ¿add exception ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants