I have managed to read the following log file into python:
import os
import glob
import pandas as pd
folder = r'C:\Users\x\x\x\x\\'
for infile in glob.glob(os.path.join(folder, 'console*')):
file = open(infile, 'r').read()
print( file)
print(file)
gives me:
John, 1,7,8, text
Matt, 3,7,10, text2
Natasha, 4,60,3,text3
I am hoping to convert into a pandas df
:
df = pd.DataFrame(file)
but getting a ValueError: DataFrame constructor not properly called!
Does anyone know how to construct the Dataframe of 3 rows by 5 columns and then add in my own columns headers? Thanks very much!