How to train a ML model efficiently without using a loop?

I have a pandas dataframe X with 6 columns and a dataframe Y with 4 columns. I’d like to forecast every row from Y using X, but without using the row that I want to forecast during the training. I got that using a loop, but I think there should be more efficient ways to do that (maybe without using a loop). Any idea?

    from tensorflow.keras import Sequential
    from tensorflow.keras.layers import Dense
    model = Sequential()
    nn=X.shape[1]
    model.add(Dense(6, activation='relu',input_shape=(nn,)))
    model.add(Dense(4, activation='sigmoid'))
    model.compile(optimizer='adam',loss='mse',metrics=['accuracy'])
    yy=[]
    for i in range(len(X)):
     results=model.fit(X.drop(i),Y.drop(i),epochs=900,
              verbose=0)
     yy+=model.predict(X.iloc[[i]]).tolist()