Skip to content

Commit

Permalink
add replace_nan_value in NonValueTransformer reverse_convert
Browse files Browse the repository at this point in the history
  • Loading branch information
MooooCat committed Jul 31, 2024
1 parent 7d37e58 commit a6f12a3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions sdgx/data_processors/transformers/nan.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,23 @@ def reverse_convert(self, processed_data: DataFrame) -> DataFrame:
Does not require any action.
"""
logger.info("Data reverse-converted by NonValueTransformer (No Action).")
def replace_nan_value(df):
"""
Scans all rows and columns in the DataFrame and replaces all cells with the value "NAN_VALUE", which is self.fill_na_value_default, with an empty string.
return processed_data
Parameters:
df (pd.DataFrame): The input DataFrame.
Returns:
pd.DataFrame: The DataFrame after replacement.
"""
# Use the replace method of DataFrame to replace "NAN_VALUE" with an empty string
df_replaced = df.replace(self.fill_na_value_default, '')
return df_replaced

logger.info("Data reverse-converted by NonValueTransformer.")

return replace_nan_value(processed_data)

pass

Expand Down

0 comments on commit a6f12a3

Please sign in to comment.