Skip to content

Commit

Permalink
Merge pull request #61 from serengil/feat-task-3010-module-loading-error
Browse files Browse the repository at this point in the history
module not found error for python 3.9 sorted
  • Loading branch information
serengil authored Oct 30, 2024
2 parents 2b3164e + 1c7e095 commit 9777e62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.9]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions chefboost/commons/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def load_module(module_name: str) -> ModuleType:
Returns:
module (ModuleType)
"""
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 9):
import importlib.util

spec = importlib.util.find_spec(module_name)
spec = importlib.util.find_spec(module_name.replace("/", "."))
if spec is None:
raise ImportError(f"Module '{module_name}' not found")

Expand Down
5 changes: 4 additions & 1 deletion chefboost/training/Training.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,10 @@ def buildDecisionTree(
# ---------------------------
# add else condition in the decision tree
if df.Decision.dtypes == "object": # classification
pivot = pd.DataFrame(df.Decision.value_counts()).sort_values(by=["count"], ascending=False)
# value_counts return count label in 3.8, and Decision label in 3.9
df_summary = pd.DataFrame(df.Decision.value_counts())
count_label = df_summary.columns[0]
pivot = df_summary.sort_values(by=[count_label], ascending=False)
else_decision = f"return '{str(pivot.iloc[0].name)}'"

if enableParallelism != True:
Expand Down

0 comments on commit 9777e62

Please sign in to comment.