why use dummies and not different integers for categorical data? I am new to stats and I want to use a regression to determine income
See below table example




age
class
location
income




23
Adult
London
23000


44
Adult
Glasgow
45000


75
Senior
Birmingham
37000


12
Child
Coventry
300




I know the different stats packages (python, r) create something like this when they have to deal with categorical data :




age
Adult
Senior
Child




23
1
0
0


44
1
0
0


75
0
1
0


12
0
0
1




Why can't we use something like this instead when we're doing a regression ?




age
class
location




23
1
1


44
1
2


75
2
3


12
3
4




The reason I am asking is because location has a lot of different values and those are converted to like 30 something columns

Let's focus just on location. You are suggesting this model for income as a function of location:
$$I_i = a + b L_i + \varepsilon_i$$
Then, the expected increase in income between Glasgow (location 2) and London (location 1) is:
$$(a + b \times 2) - (a + b \times 1) = b$$
The expected increase in income between Birmingham and Glasgow is also $b$, as is the one between Coventry and Birmingham. You only have one parameter for this so you've imposed some amount of structure on this effect.
However, the location index is immaterial; we could have assigned them in alphabetical order instead (or in any other order). If we estimate this model in alphabetical order, we'll get a different $b$, and the difference between Coventry and Birmingham is still $b$, but now the difference between Birmingham and Glasgow is $-2b$, so it's not the same as between Coventry and Birmingham (well, unless $b$ happens to be exactly zero). So, this is an entirely different structure that has been imposed.
By using separate parameters (or columns) for each location, you allow each one to have its own, location-specific effect, rather than impose all sorts of restrictions. Usually, this is what you want.
