STYLE: Fix errors in doctests
- [x] closes #51341
- [ ] [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
- [x] 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.

@MarcoGorelli I looked through the ```code_checks.sh``` file and it seems like none of the functions edited in my PR are in the script. I ran ```./ci/code_checks.sh docstrings``` and here is the output: 
![image](https://user-images.githubusercontent.com/66008784/218755170-62a646e2-7a84-47e2-bae9-a6e284b36f2b.png)
 > @MarcoGorelli I looked through the `code_checks.sh` file and it seems like none of the functions edited in my PR are in the script.

thanks for checking - OK yeah, looks like `EX03` isn't in the list of codes which are currently being checked, so that's why they wouldn't be showing up. That's another one we'll need to gradually enable, but your PR helps reduce the amount of work that'll need doing, thanks 🙌 

for the `{this}` substitution, I'd suggest just restoring it - if `flake8` is erroring, it's because it just checks the code statically rather than trying to run it, so it doesn't know what the symbol means. We can ignore it @datapythonista @MarcoGorelli Thanks for your reviews, I have created an issue for the template string problem and linked my comment there. https://github.com/pandas-dev/pandas/issues/51377 thanks @kkangs0226 