https://archlinux.org/news/removing-python2-from-the-repositories/
[18:00:40] build :: xfce4-build ➜ ~ » yay -Rc python2
[sudo] password for build:
checking dependencies...
Package (1) Old Version Net Change
python2 2.7.18-5 -76,84 MiB
Total Removed Size: 76,84 MiB
:: Do you want to remove these packages? [Y/n] y
:: Processing package changes...
(1/1) removing python2 [----------------------------------------] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
So check if you still need it or have any used apps installed needing it…
they should show up for removal question when running
yay -Rc python2
And in case it is needed by an application you do need … do NOT remove python2 and wait till there is a replacement PKGBUILD or a solution to the needed package … so check the source for them.