python pandas对Excel表操作

1、获取Excel表中所有sheet 名,获取某个sheet内容

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pandas as pd

ExFile = pd.ExcelFile('test.xlsx')
sheets = ExFile.sheet_names
print(sheets)
df = ExFile.parse('aa')
print(df)

结果:

C:\Python36\python.exe D:/python36/test.py
['Sheet1', 'Sheet2', 'Sheet3', 'aa']
   姓名   身高
0  张三  175
1  李四  178
2  王五  180

Process finished with exit code 0

猜你喜欢

转载自blog.csdn.net/weixin_37830912/article/details/96330441