There is a column "CD" which has the city name, a column "FAC18" which is the number of people each line represents. And I have a column "S3P1" which is the academic level and is type int.
When I group it by "CD" with hab_ciudad = cuestio.groupby('CD')["FAC18"].sum()
I get:
Where I have summed over "FAC18". Now, I want also to group by academic level ("S3P1"). I want it to look like this:
where the columns are the values of "S3P1" and the sum is made over "FAC18".
I tried this code: test = cuestio.groupby(['CD','S3P1'])["FAC18"].sum()
But I get this:
What's the syntax to get the form I want?