I am iterating over rows in a dataframe to see if an image is not found on a server. If it's not found, then it removes the row from the dataframe and makes a new CSV file. I would like to take that row that contains the image not found on the server and append it to a new dataframe that will create a new CSV that we can investigate why an image is not found. I can successfully remove the row from the original dataframe, but appending the new row to the new dataframe results in an empty dataframe once run. How might I solve this
filename2 = 'images_not_found.csv'
orders_csv = pd.read_csv(path + filename)
not_found_images = pd.DataFrame()
for index, row in orders_csv.iterrows():
if not os.path.isfile(row['Image']):
orders_csv.drop(index, inplace=True)
not_found_images.append(row, ignore_index=True)
orders_csv.to_csv(path + filename, index=False)
not_found_images.to_csv(path + filename2, index=False)