I have a simple dataframe, and I would like each numeric element multiplied by a scalar. However, some columns of my dataframe are strings. These strings should be included as-is in the final dataset. The real dataset is roughly 150 columns wide, with some unknown datatypes. So my solution would have to be able to scale up.
Input:
A B C D E F G
DS DZ 3 2 1 3 5
CA 3S 4 1 4 1 4
DG dD 2 2 5 7.1 2
DDS $Z 1.1 2 3 4 5
multiply numbers by 3
Output:
A B C D E F G
DS DZ 9 6 3 9 15
CA 3S 12 3 12 3 12
DG dD 6 6 15 21.3 6
DDS $Z 3.3 6 9 12 15