Skip to content

Commit

Permalink
edit data cleaning file
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinSekYi committed Jul 13, 2024
1 parent 9dd0732 commit 014b91e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/data_cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from imblearn.over_sampling import SMOTE
from sklearn.feature_selection import SelectKBest, f_classif
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import MinMaxScaler, FunctionTransformer
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
from src.exception import CustomException
Expand All @@ -22,7 +22,7 @@ def fit(self, df):
return self

def transform(self, df):
try:
try:
ncol = len(df.columns) - 1
feature_space = df.iloc[:, 0:ncol]
target_column = df.iloc[:, ncol]
Expand All @@ -48,8 +48,8 @@ def transform(self, df):
# Define a function for mapping
def map_class_labels(df):
try:
mapping = {0: "not-bankrupt", 1: "bankrupt"}
df["class"] = df["class"].map(mapping)
mapping = {0: 'not-bankrupt', 1: 'bankrupt'}
df['class'] = df['class'].map(mapping)
return df
except Exception as e:
raise CustomException(e, sys) from e
Expand Down

0 comments on commit 014b91e

Please sign in to comment.