This is what I made and it doesn't work, I made a for loop and I use it to get the index and use it in another thing why doesn't it work or can I found another method to delete the element and use the index of it.
Here is some of my code
X1_train, X1_test, y1_train, y1_test = train_test_split(EclipseFeautres, EclipseClass, test_size=0.3, random_state=0)
E_critical_class=y1_train.copy()
E_critical_class = E_critical_class[E_critical_class != 1]
for x in range(len(E_critical_class)):
if(E_critical_class[x]==1):
E=np.delete(E_critical_class,x)
deleteresult is assigned toE, but that variable isn't used anywhere. So changes that you make in one loop are just thrown away. In general though it is a bad idea to delete items one by one in a loop, even when working with lists. The array/list size changes with deletes. It would be better to collect a list of delete locations, and callnp.deletejust once with that list.