更新时间:2023-09-17 16:15:34
这似乎是一个合理的方法.pd.concat
获取一个 pandas 对象列表并将它们连接起来.append
在您循环浏览文件时将每个 frame
添加到列表中.不过,我认为有两件事需要改变.
This seems like a reasonable way to do it. The pd.concat
takes a list of pandas objects and concatenates them. append
adds each frame
to the list as you loop through the files. I see two things to change though.
frame = pd.DataFrame()
.当您将 dataframes
附加到列表时,它没有做任何事情.list
的名称更改为其他名称.也许 frames
因为它是对内容的描述,并不意味着什么.frame = pd.DataFrame()
. It is not doing anything as you are appending dataframes
to the list.list
to something else. Maybe frames
as it is descriptive of the contents and doesn't already mean something.