Skip to content

Commit

Permalink
Remove Python 3.7 specific code
Browse files Browse the repository at this point in the history
Signed-off-by: Antoni Baum <antoni.baum@protonmail.com>
  • Loading branch information
Yard1 committed Sep 11, 2023
1 parent 7f3bccc commit fef700c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
17 changes: 0 additions & 17 deletions pycaret/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
import os
import sys

# Fix for joblib on 3.7
# Otherwise, it will default to cloudpickle which
# uses pickle5, causing exceptions with joblib
# THIS HAS TO BE DONE BEFORE OTHER IMPORTS HERE
if sys.version_info < (3, 8):
import pycaret.internal.cloudpickle_compat

os.environ["LOKY_PICKLER"] = pycaret.internal.cloudpickle_compat.__name__

from joblib.externals.loky.backend.reduction import set_loky_pickler

set_loky_pickler(pycaret.internal.cloudpickle_compat.__name__)


from pycaret.utils._show_versions import show_versions

version_ = "3.1.0"
Expand Down
6 changes: 1 addition & 5 deletions pycaret/internal/preprocess/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,7 @@ def _prepare_df(self, X, out):
# Convert to pandas and assign proper column names
if not isinstance(out, pd.DataFrame):
if hasattr(self.transformer, "get_feature_names_out"):
try: # Fails for some estimators in Python 3.7
# TODO: Remove try after dropping support of Python 3.7
columns = self.transformer.get_feature_names_out()
except AttributeError:
columns = self._name_cols(out, X)
columns = self.transformer.get_feature_names_out()
elif hasattr(self.transformer, "get_feature_names"):
# Some estimators have legacy method, e.g. category_encoders
columns = self.transformer.get_feature_names()
Expand Down

0 comments on commit fef700c

Please sign in to comment.