xlsx 工作表的 reader = csv.reader(...) 等价于什么?
What's the equivalent of reader = csv.reader(...) for xlsx sheets?
我有一个脚本
path=r"mypath\myfile.xlsx"
with open(path) as f:
reader = csv.reader(f)
但它不会工作,因为代码正在尝试使用为 csv 文件制作的模块打开 xlsx 文件。
那么,是否存在 xlsx 文件的等效表达式?
xlsx 工作表的突出显示代码的等效项是:
path=r"mypath\myfile.xlsx"
import pandas as pd
with open(path) as f:
reader = pd.read_excel(f)
我有一个脚本
path=r"mypath\myfile.xlsx"
with open(path) as f:
reader = csv.reader(f)
但它不会工作,因为代码正在尝试使用为 csv 文件制作的模块打开 xlsx 文件。
那么,是否存在 xlsx 文件的等效表达式?
xlsx 工作表的突出显示代码的等效项是:
path=r"mypath\myfile.xlsx"
import pandas as pd
with open(path) as f:
reader = pd.read_excel(f)