pandans read excel to list

读取excel 指定sheet 跳过首行

 df = pd.read_excel("new.xlsx",sheet_name='字段说明', skiprows=1)

转成包含元组的列表

data_list = df.apply(lambda x: tuple(x), axis=1).values.tolist()
   for data in data_list:
      print(data)

直接成数组

 for index, row in df.iterrows():
        print(f"第{index}行数据:", list(row.items()))
        break
posted @ 2024-05-16 09:31  vx_guanchaoguo0  阅读(8)  评论(0编辑  收藏  举报