【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?

相关推荐
Blossom.118几秒前
使用Python和OpenCV实现图像识别与目标检测
人工智能·python·神经网络·opencv·安全·目标检测·机器学习
chicpopoo3 分钟前
Python打卡DAY46
开发语言·python
灏瀚星空5 分钟前
Python数学可视化:3D参数曲面与隐式曲面绘制技术
开发语言·python·3d
晨尘光6 分钟前
在Windows下编译出llama_cpp_python的DLL后,在虚拟环境中使用方法
python·llama
Java Fans22 分钟前
如何在Windows本机安装Python并确保与Python.NET兼容
开发语言·windows·python
小邹子24 分钟前
抑郁症患者数据分析
python·信息可视化·数据分析
隐藏用户_y39 分钟前
基于PyCharm推送代码到github实践记录
python
sss191s1 小时前
校招 Java 面试基础题目解析学习指南含新技术实操要点
java·python·面试
YYXZZ。。1 小时前
PyTorch——非线性激活(5)
人工智能·pytorch·python
爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ1 小时前
saveOrUpdate 有个缺点,不会把值赋值为null,解决办法
java·开发语言