Skip to content

Commit

Permalink
Merge pull request #32 from luizcavalcanti/luizcavalcanti-memory-foot…
Browse files Browse the repository at this point in the history
…print-improvements

Simplifying InvalidCnpjCpfClassifier implementation
  • Loading branch information
jtemporal authored Apr 5, 2017
2 parents 16c7620 + 82620ae commit 36a8751
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rosie/invalid_cnpj_cpf_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ def transform(self, X=None):
return self

def predict(self, X):
self._X = X.copy()
self._X['cnpj_cpf'] = self._X['cnpj_cpf'].astype(np.str)
return np.r_[self._X.apply(self.__is_invalid, axis=1)]
return np.r_[X.apply(self.__is_invalid, axis=1)]

def __is_invalid(self, row):
return (row['document_type'] in [0, 1]) & (not cpfcnpj.validate(row['cnpj_cpf']))
return (row['document_type'] in [0, 1]) & (not cpfcnpj.validate(str(row['cnpj_cpf'])))

0 comments on commit 36a8751

Please sign in to comment.