Skip to content

Commit

Permalink
remove defaultdict from attribute (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel MASSOULARD authored and Fabien VAVRAND committed Oct 2, 2019
1 parent 6ba1084 commit d941ff3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aikit/transformers/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def fit(self, X, y=None):

self._variable_modality_dict = {}
for col in self._columns_to_encode:
ddict = defaultdict(lambda :-1, self.variable_modality_mapping[col])
#ddict = defaultdict(lambda :-1, self.variable_modality_mapping[col])
ddict = dict(self.variable_modality_mapping[col])
if "__null__" in self.variable_modality_mapping[col]:
ddict[np.nan] = self.variable_modality_mapping[col]["__null__"]
ddict[None] = self.variable_modality_mapping[col]["__null__"]
Expand Down Expand Up @@ -266,8 +267,7 @@ def transform(self, X):
return result

def _transform_to_encode(self, X):

all_result_series = [X[col].map(self._variable_modality_dict[col])
all_result_series = [X[col].map( defaultdict(lambda :-1,self._variable_modality_dict[col] ))
for col in self._columns_to_encode]

if self.encoding_type == "num":
Expand Down

0 comments on commit d941ff3

Please sign in to comment.