目录
网上介绍pandas读取excel文件的文章很多,我们这边不对此读取的方法做全面的介绍,只对最常见的方法做介绍
一、安装相关库
1.1安装pandas
首先要确保安装了pandas,没安装的用pip 安装,我们利用国内的原安装,安装命令如下
pip install pytest -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
1.2 安装 openpyxl 和 xlrd 的库
我们利用pandas.read_excel () 读取excel文件,而它在内部使用 openpyxl 库,所以还必须安装 openpyxl ,否则会无法执行,利用pip安装
pip install openpyxl -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
二、读取excel文件
2.1excel文件介绍
路径为D:\Test\AutoTest\testdata\test_expend_data.xlsx
sheetname = "记账支出测试用例数据"
内容如下