Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pandas-dev#28547 - deprecate xlrd - FutureWarnings
Browse files Browse the repository at this point in the history
cruzzoe committed Nov 2, 2019

Verified

This commit was signed with the committer’s verified signature.
fiji-flo Florian Dieminger
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
@@ -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))

0 comments on commit 5c32f95

Please sign in to comment.