DOC: Fix flake8 issues with whatsnew v0.18.*
Fixed almost every flake8 issues in v0.18.*.rst except one issue
about tab-completion.

- [x] closes #24233 
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

I fixed almost every flake8 issues except one.
An issue about **tab-completion** and I have no idea how to fix it.

In `doc/source/whatsnew/v0.18.0.rst` there is a code like below.
```python
In [9]: r.<TAB>
r.A           r.agg         r.apply       r.count       r.exclusions  r.max         r.median      r.name        r.skew        r.sum
r.B           r.aggregate   r.corr        r.cov         r.kurt        r.mean        r.min         r.quantile    r.std         r.var
```

I've searched with `grep` in every whatsnew files but there was only one other example about this in `v0.17.0.rst`. Would you review this PR?