So, I currently have the below code- which calculates a new column based on two others, depending on which one has data present. I would like to add an additional step to the code. Where if the data in a column being used in the calculations (Total-S_%S, Sulphate-S_%S and Sulphate-S(HCL Leachable)_%S) is negative, the program will times the negatives value by -0.5, and then continue with the calculations as described in the code already. I'm not really sure where to start with this. Thanks,
df['Sulphide-S(calc)-C_%S'] = np.where(
df["Sulphate-S(HCL Leachable)_%S"].isna(),
df["Total-S_%S"]- df["Sulphate-S_%S"],
df["Total-S_%S"]- df["Sulphate-S(HCL Leachable)_%S"])