Getting the Key Error KeyError: '3385593926_d3e9c21170.jpg'

KeyError: ‘2513260012_03d33305cf.jpg’ error while training the model. I get it that it might be because my encoding_train={} might be null right but i am getting a length of 6000
def train_model():
for i in range(epochs):

    generator=data_generator(train_descriptions,encoding_train,word_to_index,max_len,number_pics_per_batch)
    model.fit_generator(generator,epochs=1,steps_per_epoch=steps,verbose=1)
    model.save("/model_weights/model_"+str(i)+".h5")

The loop is also not working

tried going step by step from the video

Pandas KeyError occurs when we try to access some column/row label in our DataFrame that doesn’t exist. Usually, this error occurs when you misspell a column/row name or include an unwanted space before or after the column/row name… Before doing anything with the data frame, use print(df.columns) to see column exist or not.

print(df.columns)

I was getting a similar kind of error in one of my codes. Turns out, that particular index was missing from my data frame as I had dropped the empty dataframe 2 rows. If this is the case, you can do df.reset_index(inplace=True) and the error should be resolved.