我设法将以下日志文件读入python:
sig{params(instance_class: String).returns(instance_of ParentClass)}
def build_instance instance_class
klass = Object.const_get(instance_class)
return klass.new
end
ParentClass
给我:
T.untyped
我希望转换为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)
但得到John, 1,7,8, text
Matt, 3,7,10, text2
Natasha, 4,60,3,text3
有人知道如何构造3行5列的数据框,然后添加我自己的列标题吗?非常感谢!
答案 0 :(得分:0)
import os
import glob
import pandas as pd
folder = 'C:\\'
filename2 = [y for y in glob.glob(f'{folder}\\*.*')]
# In the case of .csv files.
df_cc = pd.DataFrame()
for z in filename2:
df = pd.read_csv(z, header = None)
df_cc = df_cc.append(df)