Description
How do you use Pandas groupby to group certain columns, but not others?
Current Progress
table_D = pd.DataFrame({
    'Geo_ID': [1, 1, 1, 1, 2, 3, 4, 4, 5],
    'A_Code': [12, 12, 12, 65, 65, 65, 65, 98, 98],
    'A_Cost': [2, 9, 1, 10, 6, 7, 7, 6, 2],
}, columns=['Geo_ID', 'A_Code', 'A_Cost'])
table_D_dummies = pd.get_dummies(data = table_D, columns = ["A_Code"])
table_D_dummies_grouped = table_D_dummies.groupby(by = ["Geo_ID"]).sum()
Problem
As shown below, this correctly sums cost by Geo_ID. Unfortunately, it's also summing by A_Code.
A_Code_12, A_Code_65 and A_Code_98 should combine separately. Additionally, in the actual dataset, there are over 100 A_Codes.
Data
table_D
+--------+--------+--------+
| Geo_ID | A_Code | A_Cost |
+--------+--------+--------+
|      1 |     12 |      2 |
|      1 |     12 |      9 |
|      1 |     12 |      1 |
|      1 |     65 |     10 |
|      2 |     65 |      6 |
|      3 |     65 |      7 |
|      4 |     65 |      7 |
|      4 |     98 |      6 |
|      5 |     98 |      2 |
+--------+--------+--------+
table_D_dummies
+---+--------+--------+-----------+-----------+-----------+
|   | Geo_ID | A_Cost | A_Code_12 | A_Code_65 | A_Code_98 |
+---+--------+--------+-----------+-----------+-----------+
| 0 |      1 |      2 |         1 |         0 |         0 |
| 1 |      1 |      9 |         1 |         0 |         0 |
| 2 |      1 |      1 |         1 |         0 |         0 |
| 3 |      1 |     10 |         0 |         1 |         0 |
| 4 |      2 |      6 |         0 |         1 |         0 |
| 5 |      3 |      7 |         0 |         1 |         0 |
| 6 |      4 |      7 |         0 |         1 |         0 |
| 7 |      4 |      6 |         0 |         0 |         1 |
| 8 |      5 |      2 |         0 |         0 |         1 |
+---+--------+--------+-----------+-----------+-----------+
table_D_dummies_grouped
+--------+--------+-----------+-----------+-----------+
| Geo_ID | A_Cost | A_Code_12 | A_Code_65 | A_Code_98 |
+--------+--------+-----------+-----------+-----------+
|      1 |     22 |         3 |         1 |         0 |
|      2 |      6 |         0 |         1 |         0 |
|      3 |      7 |         0 |         1 |         0 |
|      4 |     13 |         0 |         1 |         1 |
|      5 |      2 |         0 |         0 |         1 |
+--------+--------+-----------+-----------+-----------+
 
    