【python求助】for循环,如何分别储存过程中的DataFrame

这个是我想实现的结果,每一个excel分别做没问题。

复制代码
df03 = pd.read_excel('03CP_IndStockCnsExpInd.xlsx')
df03.drop(index=[0, 1], inplace=True) ##删除行名为0,1的行

df04 = pd.read_excel('04CP_IndStockCnsExpInd.xlsx')
df04.drop(index=[0, 1], inplace=True) ##删除行名为0,1的行

# Let's concatenate both dataframes #1 and #2
investor_df_combined = pd.concat([df03, df04])
investor_df_combined
investor_df_combined.reset_index(drop = True)

(是excel表100w行放不下了,整合到一个DataFrame,表头是一模一样的)

学着用for 循环,主要问题是:

复制代码
DFs = []
for x in ['03CP_IndStockCnsExpInd.xlsx', '04CP_IndStockCnsExpInd.xlsx']:
    data_x_df = pd.read_excel(x)
    data_x_df.drop(index=[0, 1], inplace=True) ##删除行名为0,1的行
    DFs.append(data_x_df)
DFs

这样先建立空的df,for循环中用append,得到的结果每个excel还是分开的,没能合并

我想是不是DFs的创建不应该是list?

相关推荐
weixin_4454023017 小时前
Python游戏中的碰撞检测实现
jvm·数据库·python
夕除17 小时前
js--6
java·开发语言
ytttr87317 小时前
C#实现海康威视智能车牌识别
开发语言·c#
梵刹古音17 小时前
【C语言】 关键字与用户标识符
c语言·开发语言
悟能不能悟17 小时前
grpc协议
开发语言
棒棒的皮皮17 小时前
【OpenCV】Python图像处理矩特征之矩的计算/计算轮廓的面积
图像处理·python·opencv·计算机视觉
四维碎片17 小时前
【Qt】代理(Delegate)的使用
开发语言·qt
人工智能AI技术17 小时前
【Agent从入门到实践】41 部署方式选型:本地脚本、Docker容器、云服务部署
人工智能·python
Fleshy数模17 小时前
零基础玩转HTML:核心标签与页面构建
python·html
2401_8324027517 小时前
使用Docker容器化你的Python应用
jvm·数据库·python