I have a data frame with columns, say v1~v4
| _NAME | _TIMESTAMP | v0 | v1 | v2 | v3 | v4 |
|----------|---------------------|-------|------|-------|-------|-------|
| BRAKE_LH | 17-11-2021 22:50:43 | 13896 | 8262 | 12339 | 13110 | 13107 |
| BRAKE_LH | 17-11-2021 22:51:34 | 13896 | 8262 | 12339 | 13110 | 13107 |
| BRAKE_LH | 17-11-2021 22:51:35 | 13896 | 8262 | 12339 | 13110 | 13107 |
| BRAKE_LH | 17-11-2021 22:51:36 | 13896 | 8262 | 12339 | 13110 | 13107 |
| BRAKE_LH | 17-11-2021 22:51:37 | 0 | 0 | 0 | 0 | 0 |
If I want to do the below function to the columns v1~v4
df['v0'] = df['v0'].apply(lambda x: chr(round(x / 256)) + chr(x % 256)).apply(lambda x: x[::-1])
df['v1'] = df['v1'].apply(lambda x: chr(round(x / 256)) + chr(x % 256)).apply(lambda x: x[::-1])
df['v2'] = df['v2'].apply(lambda x: chr(round(x / 256)) + chr(x % 256)).apply(lambda x: x[::-1])
df['v3'] = df['v3'].apply(lambda x: chr(round(x / 256)) + chr(x % 256)).apply(lambda x: x[::-1])
df['v4'] = df['v4'].apply(lambda x: chr(round(x / 256)) + chr(x % 256)).apply(lambda x: x[::-1])
In come cases the columns goes beyond 4 columns, say 40 or 100 columns
Is there a simple way to apply it for all columns, except--> _NAME & _TIMESTAMP columns