Skip to content

Commit

Permalink
add option to manually disable substitution of illegal chars
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgard committed Jun 6, 2024
1 parent 6ff4979 commit fca9429
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tableshift/core/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ class PreprocessorConfig:
min_frequency: float = None # see OneHotEncoder.min_frequency
max_categories: int = None # see OneHotEncoder.max_categories
n_bins: int = 5 # see KBinsDiscretizer.num_bins
sub_illegal_chars: bool=True # whether to replace illegal characters in column names


def map_values(df: pd.DataFrame, mapping: dict, strict=True) -> pd.DataFrame:
Expand Down Expand Up @@ -581,7 +582,7 @@ def _post_transform(self, transformed: pd.DataFrame,
if self.config.use_extended_names:
transformed.columns = self.map_names_extended(
transformed.columns.tolist())
else:
elif self.config.sub_illegal_chars:
transformed.columns = [sub_illegal_chars(c) for c in
transformed.columns]

Expand Down

0 comments on commit fca9429

Please sign in to comment.