Skip to content

Commit 5c32f95

Browse files
committed
pandas-dev#28547 - deprecate xlrd - FutureWarnings
1 parent b657045 commit 5c32f95

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pandas/io/excel/_base.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from io import BytesIO
55
import os
66
from textwrap import fill
7+
import warnings
78

89
from pandas._config import config
910

@@ -791,7 +792,7 @@ def close(self):
791792
class ExcelFile:
792793
"""
793794
Class for parsing tabular excel sheets into DataFrame objects.
794-
Uses xlrd. See read_excel for more documentation
795+
Uses xlrd, openpyxl or odf. See read_excel for more documentation
795796
796797
Parameters
797798
----------
@@ -811,8 +812,14 @@ class ExcelFile:
811812
_engines = {"xlrd": _XlrdReader, "openpyxl": _OpenpyxlReader, "odf": _ODFReader}
812813

813814
def __init__(self, io, engine=None):
814-
if engine is None:
815+
if engine == "xlrd" or engine is None:
815816
engine = "xlrd"
817+
warnings.warn(
818+
"xlrd is deprecated and will be removed in a future "
819+
"version. Use 'openpyxl' or 'odf' instead.",
820+
FutureWarning,
821+
stacklevel=2,
822+
)
816823
if engine not in self._engines:
817824
raise ValueError("Unknown engine: {engine}".format(engine=engine))
818825

0 commit comments

Comments
 (0)