我正在使用Pyomo(以及隐式Openpyxl)从Excel导入一些数据。导入看似按预期工作,但为每个参数导入打印折旧错误。代码看起来像这样:
model = AbstractModel()
data = DataPortal(model=model)
model.A = Set(initialize=['a','b','c'])
model.B = Param(model.A)
data.load(filename="Excel.xlsx", range="Btable", format=param, param=model.B)
和错误消息:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyutilib/excel/spreadsheet_openpyxl.py:58: DeprecationWarning: Call to deprecated function get_sheet_names (Use wb.sheetnames).
self.worksheets = self.wb.get_sheet_names()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyutilib/excel/spreadsheet_openpyxl.py:62: DeprecationWarning: Call to deprecated function get_sheet_by_name (Use wb[sheetname]).1])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyutilib/excel/spreadsheet_openpyxl.py:288: DeprecationWarning: Call to deprecated function get_named_range (Use workbook.defined_names[name]).
return self.wb.get_named_range(rangeid)
由于导入似乎有效,我想至少压制这些警告。有没有人遇到过类似的问题?