Transforming negative to positive values in dataframe - Python [duplicate]
Just use the built-in abs()
function:
df_no_mv['Age_new'] = df_no_mv['Age'].abs()
This is just as per https://stackoverflow.com/a/29077254/1021819
REF: https://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.DataFrame.abs.html
FWIW, python has abs()
at the built-in level. numpy also has it.