Skip to content

Commit

Permalink
added fit to dfh
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Al-Saffar committed Dec 1, 2023
1 parent e7670d5 commit 38bd7d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions myresources/crocodile/deeplearning_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def gui_dataframe(df: 'pd.DataFrame'): install_n_import("pandasgui").show(df)

def encode(self, df: pd.DataFrame, precision: str) -> pd.DataFrame:
"""Converts the dataframe to numerical format. Missing values are encoded as `pd.NA`, otherwise, encoders will fail to handle them."""
df[self.cols_ordinal] = self.encoder_ordinal.transform(df[self.cols_ordinal])
df.loc[:, self.cols_ordinal] = self.encoder_ordinal.transform(df[self.cols_ordinal])
tmp = self.encoder_onehot.transform(df[self.cols_onehot])
df.drop(columns=self.cols_onehot, inplace=True)
df[self.encoder_onehot.get_feature_names_out()] = tmp
df[self.cols_numerical] = df[self.cols_numerical].to_numpy().astype(precision)
df.loc[:, self.cols_numerical] = df.loc[:, self.cols_numerical].to_numpy().astype(precision)
return df

def impute_standardize(self, df: pd.DataFrame) -> pd.DataFrame:
Expand Down

0 comments on commit 38bd7d3

Please sign in to comment.