I've been looking for this error here, but I only found this solution 1 (which doesn't work in my case). Does anybody can guide me on how to solve it?.
My dataset (df2) looks like this:
      id_cl  id_sup total_t cl_ind  cl_city  sup_ind  sup_city  same_city
0   1000135 1797029  414.85  I5610  11308.0    G4711   10901.0   no
1   1000135 1798069  19.76   I5610  11308.0    G4719   10901.0   no
2   1000135 1923186  302.73  I5610  11308.0    G4630   10901.0   no
3   1000135 2502927  1262.86 I5610  11308.0    G4630   11308.0   yes
4   1000135 2504288  155.04  I5610  11308.0    G4711   11308.0   yes
I need to group this dataset as follows:
df_sup = df2.groupby(['cl_city','cl_ind','same_city']).agg({'id_sup':'nunique', 'total_t':'sum'})
But when performing this, I'm getting this error!:
ValueError: Grouper for 'cl_city' not 1-dimensional
As a result I need something like this:
                                 id_sup      total_t
cl_city     cl_ind  same_city       
  10701      A0112         no         2    21964.22
                          yes        31     3530.40
             A0122         no      2374 23328061.47
                          yes      1228  2684408.12
             A0127         no        11    19962.68
                          yes         7      915.44
             A0163         no       357   574827.97
                          yes       140     60385.7
