gopup icon indicating copy to clipboard operation
gopup copied to clipboard

调用marco_cmlrd 时报“XLRDError”

Open eminentli opened this issue 3 years ago • 1 comments

import gopup as gp df_index = gp.marco_cmlrd() print(df_index)

报错如下


XLRDError Traceback (most recent call last) in ----> 1 df_index = gp.marco_cmlrd() 2 print(df_index)

~\AppData\Roaming\Python\Python39\site-packages\gopup\economic\marco_cn.py in marco_cmlrd() 20 """ 21 url = "http://114.115.232.154:8080/handler/download.ashx" ---> 22 excel_data = pd.read_excel(url, sheet_name="Data", header=0, skiprows=1) 23 excel_data["Period"] = pd.to_datetime(excel_data["Period"]).dt.strftime("%Y-%m") 24 excel_data.columns = [

~\AppData\Roaming\Python\Python39\site-packages\pandas\util_decorators.py in wrapper(*args, **kwargs) 294 ) 295 warnings.warn(msg, FutureWarning, stacklevel=stacklevel) --> 296 return func(*args, **kwargs) 297 298 return wrapper

~\AppData\Roaming\Python\Python39\site-packages\pandas\io\excel_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols) 302 303 if not isinstance(io, ExcelFile): --> 304 io = ExcelFile(io, engine=engine) 305 elif engine and engine != io.engine: 306 raise ValueError(

~\AppData\Roaming\Python\Python39\site-packages\pandas\io\excel_base.py in init(self, path_or_buffer, engine) 865 self._io = stringify_path(path_or_buffer) 866 --> 867 self._reader = self._enginesengine 868 869 def fspath(self):

~\AppData\Roaming\Python\Python39\site-packages\pandas\io\excel_xlrd.py in init(self, filepath_or_buffer) 20 err_msg = "Install xlrd >= 1.0.0 for Excel support" 21 import_optional_dependency("xlrd", extra=err_msg) ---> 22 super().init(filepath_or_buffer) 23 24 @property

~\AppData\Roaming\Python\Python39\site-packages\pandas\io\excel_base.py in init(self, filepath_or_buffer) 349 # N.B. xlrd.Book has a read attribute too 350 filepath_or_buffer.seek(0) --> 351 self.book = self.load_workbook(filepath_or_buffer) 352 elif isinstance(filepath_or_buffer, str): 353 self.book = self.load_workbook(filepath_or_buffer)

~\AppData\Roaming\Python\Python39\site-packages\pandas\io\excel_xlrd.py in load_workbook(self, filepath_or_buffer) 33 if hasattr(filepath_or_buffer, "read"): 34 data = filepath_or_buffer.read() ---> 35 return open_workbook(file_contents=data) 36 else: 37 return open_workbook(filepath_or_buffer)

~\AppData\Roaming\Python\Python39\site-packages\xlrd_init_.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows, ignore_workbook_corruption) 168 # files that xlrd can parse don't start with the expected signature. 169 if file_format and file_format != 'xls': --> 170 raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported') 171 172 bk = open_workbook_xls(

XLRDError: Excel xlsx file; not supported

eminentli avatar Dec 14 '20 07:12 eminentli

安装旧版本 pip install xlrd==1.2.0

justinzm avatar Dec 21 '20 14:12 justinzm