Subtract value from only select columns [closed]

I am trying to subtract a value in one column from the values of only a select range of columns in my DataFrame, but I am not sure how to select these specific columns for my subtractions.

I have the following DataFrame:

    Area      1         2         3         4      Select      Value
----------------------------------------------------------------------
0      22     54        33        46        23           4         23
1      45     36        54        32        14           1         36 
2      67     34        29        11        14           3         11
3      54     35        19        22        45           2         19
4      21     27        39        43        22           3         43  

For each row, I want to take the value in the “Value” column and subtract it from the value under only columns with a numbered header, excluding the “Area” and “Select” columns. And so I want to produce the following DataFrame:

    Area      1         2         3         4      Select      Value
----------------------------------------------------------------------
0      22     29        10        23         0           4         23
1      45      0        18        -4        14         -22         36 
2      67     23        18         0         3          -8         11
3      54     16         0         3        26         -17         19
4      21    -16        -4         0       -21         -40         43 

How can this be accomplished in python? I am confused about how to subtract from only certain columns, and most tutorials I find online only tell how to select from all or a single specific column.

Answer

Another solution, using .filter:

numbered = df.filter(regex=r"^d+$")
df.loc[:, numbered.columns] = numbered.sub(df["Value"], axis=0)

print(df)

Prints:

   Area   1   2   3   4  Select  Value
0    22  31  10  23   0       4     23
1    45   0  18  -4 -22       1     36
2    67  23  18   0   3       3     11
3    54  16   0   3  26       2     19
4    21 -16  -4   0 -21       3     43