You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
df = pd.DataFrame(
{
"a": [1, 1, 2],
"b": [3, 4, 5],
},
index=pd.MultiIndex.from_tuples([(1, 1), (1, 2), (1, 3)], names=["f", "f"]),
)
gb = df.groupby("f")
result = gb.sum()
print(result)
# a b
# f
# 1 4 12
There are two levels with the label "f" here; I think what the user wants in such a case is ambiguous. As such, we should raise instead of using the first level with the given label. In the similar case of grouping by columns, we currently raise.
The text was updated successfully, but these errors were encountered:
From #49373 (comment)
There are two levels with the label "f" here; I think what the user wants in such a case is ambiguous. As such, we should raise instead of using the first level with the given label. In the similar case of grouping by columns, we currently raise.
The text was updated successfully, but these errors were encountered: