Backport PR #49053 on branch 1.5.x (REVERT caching in find_stack_level)
#49053

Revert "PERF cache find_stack_level (#48023)"

This reverts commit 2f8d0a36703e81e4dca52ca9fe4f58c910c1b304.

Co-authored-by: MarcoGorelli <>
(cherry picked from commit 0106c26529900bad0561efb9c9180f7f016365b0)

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Sorry should have asked first, so this is not really a backport? sorry not sure what you mean, isn't it a backport? I got a bit confused, sorry for that. Did you revert this strictly on the 1.5.x branch or did you cherry pick #49053 onto the 1.5.x branch? I followed the instructions from https://github.com/pandas-dev/pandas/pull/49053#issuecomment-1278617081 - there were some conflicts to resolve Ok got you, thx for clearing this up for me :) no worries, thanks for checking

actually, looks like I got a different commit message than usual as, after fixing the conflicts, I did
```
git cherry-pick --continue
```
rather than
```
git commit -am 'Backport PR #49053: REVERT caching in find_stack_level'
``` It looks like we removed a couple of find_stack_levels on main that are still present on 1.5.x @phofl good to merge? I've been through the diff and it looks fine to me, doesn't look like anything unexpected has crept in when resolving conflicts thx @MarcoGorelli 