Skip to content

Commit

Permalink
pandas-dev#28547 - deprecate xlrd - FutureWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzzoe committed Nov 2, 2019
1 parent b657045 commit 5c32f95
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from io import BytesIO
import os
from textwrap import fill
import warnings

from pandas._config import config

Expand Down Expand Up @@ -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
----------
Expand All @@ -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))

Expand Down

0 comments on commit 5c32f95

Please sign in to comment.