Skip to content

Commit 9777e62

Browse files
authored
Merge pull request #61 from serengil/feat-task-3010-module-loading-error
module not found error for python 3.9 sorted
2 parents 2b3164e + 1c7e095 commit 9777e62

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
python-version: [3.8]
26+
python-version: [3.9]
2727

2828
steps:
2929
- uses: actions/checkout@v3
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
strategy:
4949
matrix:
50-
python-version: [3.8]
50+
python-version: [3.9]
5151

5252
steps:
5353
- uses: actions/checkout@v3

chefboost/commons/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ def load_module(module_name: str) -> ModuleType:
1212
Returns:
1313
module (ModuleType)
1414
"""
15-
if sys.version_info >= (3, 11):
15+
if sys.version_info >= (3, 9):
1616
import importlib.util
1717

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

chefboost/training/Training.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,10 @@ def buildDecisionTree(
557557
# ---------------------------
558558
# add else condition in the decision tree
559559
if df.Decision.dtypes == "object": # classification
560-
pivot = pd.DataFrame(df.Decision.value_counts()).sort_values(by=["count"], ascending=False)
560+
# value_counts return count label in 3.8, and Decision label in 3.9
561+
df_summary = pd.DataFrame(df.Decision.value_counts())
562+
count_label = df_summary.columns[0]
563+
pivot = df_summary.sort_values(by=[count_label], ascending=False)
561564
else_decision = f"return '{str(pivot.iloc[0].name)}'"
562565

563566
if enableParallelism != True:

0 commit comments

Comments
 (0)