Open
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
dti = pd.date_range('2016-01-01', periods=3)
idx = Index(range(3))
ser = pd.Series(range(3), index=dti)
ser2 = pd.Series(range(3), index=idx)
key = (1, 2)
value = 9
ser[key] = value # <- raises KeyError: 'key of type tuple not found and not a MultiIndex'
ser2[key] = value # <- raises pandas.errors.IndexingError: Too many indexers
Issue Description
In this example the user wants to treat (1,2) as a scalar label but doing so fails. I'd be open to "the user shouldn't do this". Otherwise I think something like #42349 to make users be explicit when they want to do something ugly like this is probably simpler than us trying to do inference on maybe-labels.
Expected Behavior
NA
Installed Versions
Replace this line with the output of pd.show_versions()