I’m using a function to drop a record from DataFrame in file and when I try to execute a function a few times it drops only last record. Why does it work like that?
Here’s some code.
def delete_title(title):
i = file[file.TITLE == title].index[0]
df = file.drop(file.index[i])
df.to_csv("filename.csv", index=False)
I expect it to drop all the records when I’m executing a function a few times f.e. I used a function 3 times and I want it to delete 3 records.
Thanks for answers 😉
New contributor
user25258272 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.