Skip to content

Commit e2b66db

Browse files
fix: TypeError: Object with dtype category cannot perform the NumPy op log1p (#108)
* fix: TypeError - Object with dtype category cannot perform the numpy op log1p Signed-off-by: HimanshuRRai <himanshu.rai@fujitsu.com> * fix: resolve isort and pysen version compatibility issue in CI workflow Signed-off-by: HimanshuRRai <himanshu.rai@fujitsu.com> * fix: Upgrade upload-artifact and download-artifact to v4 Signed-off-by: HimanshuRRai <himanshu.rai@fujitsu.com> * fix: Conflict issue Unable to upload to same artifact name Signed-off-by: HimanshuRRai <himanshu.rai@fujitsu.com> --------- Signed-off-by: HimanshuRRai <himanshu.rai@fujitsu.com> Co-authored-by: HimanshuRRai <himanshu.rai@fujitsu.com>
1 parent d61c3a7 commit e2b66db

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
python-version: ${{ env.PYTHON_VERSION }}
4343

4444
- name: Install Dependencies
45-
run: pip install pysen flake8 black isort
45+
run: pip install pysen flake8 black isort==5.12.0
4646

4747
- name: Pysen run lint
4848
run: pysen run lint

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ jobs:
5858
run: poetry run -- pytest -k ${{ matrix.test }}
5959

6060
- name: Upload Coverage
61-
uses: actions/upload-artifact@v3
61+
uses: actions/upload-artifact@v4
6262
with:
6363
name: ${{ matrix.test }}
6464
include-hidden-files: true
6565
path: .coverage
6666
retention-days: 1
67+
overwrite: true
68+
6769

6870
additional_test:
6971
strategy:
@@ -101,12 +103,13 @@ jobs:
101103
run: poetry run -- pytest -k ${{ matrix.test }}
102104

103105
- name: Upload Coverage
104-
uses: actions/upload-artifact@v3
106+
uses: actions/upload-artifact@v4
105107
with:
106108
name: ${{ matrix.test }}
107109
include-hidden-files: true
108110
path: .coverage
109111
retention-days: 1
112+
overwrite: true
110113

111114
report_coverage:
112115
runs-on: ubuntu-latest
@@ -123,7 +126,7 @@ jobs:
123126
python-version: 3.11
124127

125128
- name: Download Coverage Files
126-
uses: actions/download-artifact@v3
129+
uses: actions/download-artifact@v4
127130

128131
- name: Install coverage
129132
run: pip install coverage

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ jobs:
5757
run: poetry run -- pytest -k ${{ matrix.test }}
5858

5959
- name: Upload Coverage
60-
uses: actions/upload-artifact@v3
60+
uses: actions/upload-artifact@v4
6161
with:
6262
name: ${{ matrix.test }}
6363
include-hidden-files: true
6464
path: .coverage
6565
retention-days: 1
66+
overwrite: true
6667

6768
report_coverage:
6869
runs-on: ubuntu-latest
@@ -78,7 +79,7 @@ jobs:
7879
python-version: 3.11
7980

8081
- name: Download Coverage Files
81-
uses: actions/download-artifact@v3
82+
uses: actions/download-artifact@v4
8283

8384
- name: Install coverage
8485
run: pip install coverage

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ default = "sapientml_core.preprocess.default:DefaultPreprocess"
6565
sample-dataset = "sapientml_core.datastore.localfile.export_modules"
6666

6767
[tool.pysen]
68-
version = "0.10"
68+
version = "0.11.0"
6969

7070
[tool.pysen-cli]
7171
settings_dir = ".pysen"

sapientml_core/adaptation/generation/pipeline_template.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import sys
1818
from pathlib import Path
1919

20+
import pandas as pd
2021
from jinja2 import Environment, FileSystemLoader
2122
from pydantic import BaseModel
2223
from sapientml import macros
@@ -321,6 +322,12 @@ def generate_snippet(self, component, training_dataframe, test_dataframe, train_
321322
relevant_cols = sorted(list(set(relevant_cols) - set(pipeline.task.target_columns)))
322323
api_label = component.label_name.split(":")[2]
323324

325+
# Ensure only numerical columns are selected before parsing to 'log' transformation.
326+
if api_label == "log":
327+
relevant_cols = [
328+
col for col in relevant_cols if pd.api.types.is_numeric_dtype(pipeline.all_columns_datatypes[col])
329+
]
330+
324331
if len(relevant_cols) == 0 and api_label not in ["STANDARD", "SMOTE"]:
325332
logger.debug("No relevant columns found for " + api_label)
326333
return adapted_snippets

0 commit comments

Comments
 (0)