From 5c32f9579e38e9d75775b823cd0d9e0dcded9d62 Mon Sep 17 00:00:00 2001 From: Mike Robinson Date: Sat, 2 Nov 2019 18:16:11 +0000 Subject: [PATCH] #28547 - deprecate xlrd - FutureWarnings --- pandas/io/excel/_base.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index 1f1ad55969d6fb..d39db4e2456dbb 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -4,6 +4,7 @@ from io import BytesIO import os from textwrap import fill +import warnings from pandas._config import config @@ -791,7 +792,7 @@ def close(self): class ExcelFile: """ Class for parsing tabular excel sheets into DataFrame objects. - Uses xlrd. See read_excel for more documentation + Uses xlrd, openpyxl or odf. See read_excel for more documentation Parameters ---------- @@ -811,8 +812,14 @@ class ExcelFile: _engines = {"xlrd": _XlrdReader, "openpyxl": _OpenpyxlReader, "odf": _ODFReader} def __init__(self, io, engine=None): - if engine is None: + if engine == "xlrd" or engine is None: engine = "xlrd" + warnings.warn( + "xlrd is deprecated and will be removed in a future " + "version. Use 'openpyxl' or 'odf' instead.", + FutureWarning, + stacklevel=2, + ) if engine not in self._engines: raise ValueError("Unknown engine: {engine}".format(engine=engine))