[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)
原文地址:https://www.cnblogs.com/dilex/p/15578424.html