python关于excel常用函数(pandas篇)

iterrows函数:

Pandas的基础数据结构可以分为两种:DataFrame和Series。不同于Series的是,Dataframe不仅有行索引还有列索引 。df.iterrows( )函数:可以返回所有的行索引,以及该行的所有内容。

pd.read_excel,如果不写sheet_name=None,他就只读第一个sheet,写了就读所有sheet,查看第一个sheet用df1 = all_sheet'sheet_name'就行

python 复制代码
output_lines = []
all_sheet = pd.read_excel('场景推荐测试集new.xlsx',sheet_name=None)

# df1 = pd.read_excel('111.xlsx')
df1 = all_sheet['纯净']

for index, row in df1.iterrows():
    current_scene = row['场景名称']
    param = f"车窗状态:{row['车窗状态']}|空调循环模式:{row['空调循环模式']}|车速:{row['车速']}"
    query = row['query']
    output_lines.append(f'{{"current_scene":"{current_scene}","param":"{param}","query":"{query}"}}')

原数据

相关推荐
geovindu1 小时前
CSharp: LogHelper
开发语言·后端·c#·.net
奈斯先生Vector1 小时前
大模型 Agentic Workflow 架构解构:异构 API 调度与 Token 路由的多模态系统设计
开发语言·前端·架构·prompt·aigc·音视频
冻柠檬飞冰走茶1 小时前
PTA基础编程题目集 7-20 打印九九口诀表(C语言实现)
c语言·开发语言·数据结构·算法
Access开发易登软件1 小时前
Access 怎么做前后端分离?用 Web API 读写 SQL Server
前端·数据库·人工智能·microsoft·excel·access
Jay-r1 小时前
手势粒子特效系统 Gesture Particle FX(附源码下载)
python·ai·编程·pygame·百度云·手势控制
额恩661 小时前
ResearchPilot 第三阶段总结报告
python·算法
红叶舞2 小时前
基于线段树的数据结构
数据结构·python·算法
创世宇图2 小时前
Video2Txt:160 行代码实现本地视频转文字
python·faster-whisper·video2txt·large-v3-turbo
Richard.Wong2 小时前
qt生成dll供C#调用
开发语言·qt
wang_xin_8882 小时前
PHP函数
开发语言·php