dimanche 5 janvier 2020

numpy.ndarray' object has no attribute 'iloc

In order to divide to train test data:

X_train, X_test, y_train, y_test = train_test_split(X, y.iloc[:,1], test_size=0.3,random_state=seed, stratify=y)

but when I run I saw this error:(I have written the size of x and y)

Shape(X)= (284807, 28)
    Shape(y)= (284807,)
    Traceback (most recent call last):
     , in <module>
        X_train, X_test, y_train, y_test = train_test_split(X, y.iloc[:,1], test_size=0.3,random_state=seed, stratify=y)
    AttributeError: 'numpy.ndarray' object has no attribute 'iloc'

How to solve this problem?

Aucun commentaire:

Enregistrer un commentaire