Skip to content

BUG: read_excel failing to check older xlrd versions properly #39355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 1, 2021
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.2.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Fixed regressions
Bug fixes
~~~~~~~~~

-
- Fixed bug in :meth:``read_excel`` that caused it to fail when checking version of older xlrd versions(:issue:`38955`)
-

.. ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from pandas._libs.parsers import STR_NA_VALUES
from pandas._typing import Buffer, DtypeArg, FilePathOrBuffer, StorageOptions
from pandas.compat._optional import import_optional_dependency
from pandas.compat._optional import _get_version, import_optional_dependency
from pandas.errors import EmptyDataError
from pandas.util._decorators import Appender, deprecate_nonkeyword_arguments, doc

Expand Down Expand Up @@ -1056,7 +1056,7 @@ def __init__(
else:
import xlrd

xlrd_version = LooseVersion(xlrd.__version__)
xlrd_version = _get_version(xlrd)

if xlrd_version is not None and isinstance(path_or_buffer, xlrd.Book):
ext = "xls"
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/excel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from pandas.compat._optional import import_optional_dependency
from pandas.compat._optional import _get_version, import_optional_dependency

pytestmark = [
pytest.mark.filterwarnings(
Expand All @@ -29,4 +29,4 @@
else:
import xlrd

xlrd_version = LooseVersion(xlrd.__version__)
xlrd_version = _get_version(xlrd)