I have the following Pandas DataFrame:
factor_A | factor_B | factor_C |
---|---|---|
0.0384 | -0.0565 | 0.0964 |
-0.0598 | 0.0967 | 0.9156 |
0.8795 | 0.0254 | -0.0853 |
I now want to create some new columns or a new df (factor_A_signal_A, factor_B_signal_B and so on) with the following if statement: If the factor_x is > 0, than 1, otherwise -1.
So far so good. But the problem is, that at the moment I don't know how many factors I will put into my dataframe and I can't do an if/else statement for example 100 columns.
Could you please help me? I need this step to multiply each factor with each signal.
Aucun commentaire:
Enregistrer un commentaire