replaced old format strings
Changed the string formatting to f-strings.
ref #29547 
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Thanks for the PR - Please run black on your changes:

```
Checking black formatting
would reformat /home/runner/work/pandas/pandas/pandas/tests/internals/test_internals.py
would reformat /home/runner/work/pandas/pandas/pandas/tests/tseries/frequencies/test_inference.py
``` @UnforgivenSoul can you fix merge conflict and address comments? Closing as stale