Skip to content

Replacing mean first problem #2

@21020620

Description

@21020620

The file 4.2 Preprocess.ipynb has this part for replacing NaN and Infinity values
`
df.iloc[:, df.columns != "Label"] = df.groupby("Label").transform(lambda x: x.fillna(x.mean()))

df = df.replace([np.inf], np.nan)

df.iloc[:, df.columns != "Label"] = df.groupby("Label").transform(lambda x: x.fillna(x.max()))`

However, replacing like this is not a good strategy, because the mean() actually takes into account the Infinity (np.inf) values, and making the mean values become Infinity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions