[Python]使用pandas遍历excle文件的数据

安装库

pip install openpyxl -i https://pypi.douban.com/simple/
pip install pandas -i https://pypi.douban.com/simple/

excel文件示例

image

python代码

import pandas as pd


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    data = pd.read_excel("data.xlsx", sheet_name=0)
    for row in data.itertuples():
        print(row.name, row.age)
posted @ 2021-11-19 17:33  dilex  阅读(1322)  评论(0编辑  收藏  举报