BUG: Series.loc raising KeyError for Iterator indexer in case of setitem
- [x] closes #39614
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry

can you add any relevant cases to SetitemCastingEquivalents The functions in there don't work with a generator.

Are you referring to adding a new function or to add a parametrization? Parametrization won't work with a generator, while adding a new function would cause a lot of special casing I think > Are you referring to adding a new function or to add a parametrization? Parametrization won't work with a generator, while adding a new function would cause a lot of special casing I think

i was thinking adding to test_slice_key a check with `(x for x in indkey)` and in test_int_key one for `(x for x in [key])` At thx. I though you were talking about adding another function. 

Should a Generator work for iloc?

```
IndexError: .iloc requires numeric indexers, got <generator object <genexpr> at 0x7f86ac39a890>
```

iloc.getitem raises this, so I assume no? > Should a Generator work for iloc?

i dont know if we have a specific policy for that.  my only opinion here is that loc/iloc/`__getitem__`/`__setitem__` should be consistent > At thx. I though you were talking about adding another function.
> 
> Should a Generator work for iloc?
> 
> ```
> IndexError: .iloc requires numeric indexers, got <generator object <genexpr> at 0x7f86ac39a890>
> ```
> 
> iloc.getitem raises this, so I assume no?

I don't think we accept iterator / generators for indexers, though we do in the constructors. I think its ok that we do, but agree that we should generally test these. Can you open an issue for this. err rather, I agree with @jbrockmendel that we should systemcially test all setter & getter indexing methods in order to close this (rather than just adding in a specific place). This would support Iterators for iloc and loc consistently can you merge master Done I have added support for more dimensional iloc indexers. This should cover all cases now can you rebase Done probably needs another rebase, but i think this was ready rebased thanks @phofl very nice