Why doesn't my csv-file write all the rows to txt-files in Pandas?

131 views Asked by At

I am trying to save each row in my dataframe to a separate txt-file, with the content in one of the columns named after the other column. I got it to work but it only saves 4445 rows out of 46000. Any suggestions on what I could be doing wrong?

This is the code i am using:

file = 'Test_dir/{}.txt'

for i in df.index:
    content = df["content"][i]
    name = df["name"][i]
    with open(file.format(name), "w") as f:
        f.write(content)
0

There are 0 answers