Skip to content

Commit

Permalink
Expanded commit 69fd0f7
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Sep 20, 2023
1 parent ea17da5 commit d5357b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion sklearn2pmml/cross_reference/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pandas import DataFrame
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import FeatureUnion
from sklearn2pmml.preprocessing import IdentityTransformer
Expand Down Expand Up @@ -36,7 +37,10 @@ def fit(self, X, y = None):

def transform(self, X):
for idx, name in enumerate(self.names):
x = X[:, idx]
if isinstance(X, DataFrame):
x = X.iloc[:, idx]
else:
x = X[:, idx]
self.memory[name] = x.copy()
return numpy.empty(shape = (X.shape[0], 0), dtype = int)

Expand Down
4 changes: 2 additions & 2 deletions sklearn2pmml/cross_reference/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class MemorizerTest(TestCase):

def test_fit_transform(self):
def test_transform(self):
memory = dict()
self.assertEqual(0, len(memory))
memorizer = Memorizer(memory, ["int"])
Expand All @@ -31,7 +31,7 @@ def test_fit_transform(self):

class RecallerTest(TestCase):

def test_fit_transform(self):
def test_transform(self):
memory = {
"int": [-1, 1]
}
Expand Down

0 comments on commit d5357b2

Please sign in to comment.