Skip to content

ImportError: cannot import name 'reduce' from 'pandas_datareader.compat' when using pandas_datareader.wb #974

Closed
@agcr

Description

@agcr

How to reproduce:
from pandas_datareader import wb

Error was introduced in the commit 30b6d87 that accidentally (?) deleted import of reduce function from functools:

diff --git a/pandas_datareader/compat/init.py b/pandas_datareader/compat/init.py
index 5eba99d..0555141 100644
--- a/pandas_datareader/compat/init.py
+++ b/pandas_datareader/compat/init.py
@@ -1,5 +1,4 @@
-from distutils.version import LooseVersion
-from functools import reduce
+from packaging import version
from io import StringIO
from urllib.error import HTTPError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions