I have 500 text files, I need to find out how many entities are in each files. I did that in the following code:
import os
import pandas as pd
path = "newData"
files = [file for file in os.listdir(path) if file.endswith(".txt")]
c=0
for file in files:
    df = pd.read_csv(os.path.join(path, file), 
                     sep=' ',engine='python')
    
    df.columns = ['word','token','?']
    
    problem = df['token'].tolist().count('B-Problem')
    method = df['token'].tolist().count('B-Method\oTool')
    data = df['token'].tolist().count('B-Dataset')
I need to create an excel sheet to show the information excel output expect:
Filename  #ofProblem  #ofMethod  #ofData
admin.txt    {problem}   {method}  {data}
how can I store them into one big excel sheet for all 500files?
 
    