I have made a script to check validity of some files, and write to a data frame as out put listing name of valid and in vaild with comments.
but when i run i am not able to insert all the files names to data frame, only the first file name is updated
my code is as follows:
file_path = 'C:\file'
f =next(os.walk(file_path))[2]
df = pd.DataFrame(index=range(1,len(f)) ,columns = ['Valid Files','In Valid Files','Comments'])
for file in f:
    filename = file
    file_name = '%s'%file_path+'\\'+'%s'%file
    try:
        parsefile('%s'%file_name)
        df["Valid Files"]= '%s'%filename
        df["Comments"] = '--'
    except Exception, e:
        df["In Valid Files"]= '%s'%filename
        df["Comments"]= e
df  
My output is
Valid Files    In Valid Files   Comments
1   Testa.xml     Test_f.xml    error1
2   Testa.xml     Test_f.xml    error1
3   Testa.xml     Test_f.xml    error1
But my expectation is something like this
Valid Files    Comments  In Valid Files  Comments
1   Testa.xml     --        Test_f.xml   error1
2   Testb.xml     --        Test_h.xml   error2
3   Testc.xml     --        Test_k.xml   error3
expecting improvements and suggestions. Thanks in advance.
