The data frame is like below
df:
| A | B | C | D |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 |
I want to set a specific formula only for column D.
Formula : (each value in [D] - first value of [D])/SD SD = df['D'].std()
I wrote this code and did not work:
Funtion = (df.D.iloc[] - df.['D'].iat[0])/SD
df['D'] = df['D'].apply(Function, axis=1)
Is there also a way to use "for" cycle?