DEV: reduce merge conflicts by sorting whatsnew notes by issue number?
- [ ] closes #51712 (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.


The script which does this is `scripts/sort_whatsnew_note.py`. There's a defensive check inside to validate that it has only reordered the lines of a file, and hasn't changed anything else

---

Rather than tagging all of core/triage, I've just request a review from whoever participated in #50275 - but if this proves controversial we can tag the rest
Implementation seems fine, im going to post general thoughts in #51712  Agree implementation looks fine, would be good to see if could be automated as part of the test suite.  Could you add that so one could check the before and after whatsnew file for differences? yup, done - have run it over all files, you can check what it changes This feels like a real win to me for reducing whatsnew conflicts.
 Thanks!

> Also, going forward, if someone does a PR and updates the whatsnew of the latest version, is there something we can do to automate the sorting as part of either pre-commit or CI?

Yup, it's in pre-commit One more - does this run in CI and will CI fail if this returns non-zero?   That's right! You can see it here: https://github.com/pandas-dev/pandas/actions/runs/4312190011/jobs/7522443368

```
 sort whatsnew entries by issue number...................................................................Passed
- hook id: sort-whatsnew-items
- duration: 0.05s
```

And yes, it'll return non-zero exit code if it would've modified any file (like all pre-commit hooks) I've amended this to exclude 2.0.0, so it'll only be applied going forwards

If in 3.0.0 we want to keep some parts of a section grouped, we can just make subsections, e.g.
```rst
Removal of prior version deprecations/changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Non-keyword arguments
^^^^^^^^^^^^^^^^^^^^^
- Disallow passing non-keyword arguments to :func:`read_excel` except ``io`` and ``sheet_name`` (:issue:`34418`)
- Disallow passing non-keyword arguments to :meth:`DataFrame.drop` and :meth:`Series.drop` except ``labels`` (:issue:`41486`)

Behavior changes
^^^^^^^^^^^^^^^^
- Changed behavior of :meth:`Series.quantile` and :meth:`DataFrame.quantile` with :class:`SparseDtype` to retain sparse dtype (:issue:`49583`)
``` Thanks @MarcoGorelli 