DOC: Use more executed instead of static code blocks
- [x] closes #45235 (Replace xxxx with the GitHub issue number)
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

Looks like the docs are passing here so merging