From 7b05e0999a1236f9813eed995b56123f25f0576c Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 14 Jun 2021 20:34:38 +0200 Subject: [PATCH] DEP: move pkg_resources back inline in function (delayed import) --- pandas/plotting/_core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 00d87b707580d..302d5ede0ae86 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -7,8 +7,6 @@ Sequence, ) -import pkg_resources - from pandas._config import get_option from pandas._typing import IndexLabel @@ -1745,6 +1743,8 @@ def _load_backend(backend: str) -> types.ModuleType: types.ModuleType The imported backend. """ + import pkg_resources + if backend == "matplotlib": # Because matplotlib is an optional dependency and first-party backend, # we need to attempt an import here to raise an ImportError if needed.