BUG: replace na_rep for pd.NA values in `to_string`
State: closed

- [x] xref #54872 
- [ ] [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.


Labels:

Comments:
@mroeschke Need some help here. This test will fail `pandas/tests/arrays/string_/test_string.py::test_repr`. Should I update the test or will that break some behavior? 
@mroeschke  The documentation says, that the default value for `na_rep` is 'NaN' so in pandas/io/formats/format.py, the replace never happens.
```python
    def _format(x):
            if self.na_rep is not None and is_scalar(x) and isna(x):
                try:
                    # try block for np.isnat specifically
                    # determine na_rep if x is None or NaT-like
                    if x is None:
                        return "None"
                    elif x is NA:
                        return str(NA)
                    elif x is NaT or np.isnat(x):
                        return "NaT"
                except (TypeError, ValueError):
                    # np.isnat only handles datetime or timedelta objects
                    pass
                return self.na_rep
``` 

and if I replace `elif x is NA: return self.na_rep` then it breaks tests because the expectation is to get `<NA>`
Which tests need fixing?
@mroeschke  Some tests that are failing are below. This is not an exhaustive list. The `expected` value in these tests is `<NA>` but according to docs it should be `NaN` since that's the default value for `na_rep`. Somehow this behaviour is not in place.

- pandas/tests/arrays/boolean/test_repr.py::test_repr
- pandas/tests/arrays/floating/test_repr.py::test_frame_repr[Float32Dtype]
-  pandas/tests/arrays/integer/test_repr.py::test_frame_repr[Int8Dtype]
- pandas/tests/arrays/string_/test_string.py::test_repr[pyarrow]
- pandas/tests/io/formats/test_to_string.py::test_nullable_float_to_string[Float32]
@mroeschke pinging for visibility. Please let me know if the above message was clear or not.
@mroeschke need some inputs here :)
Yeah I think the tests should be updated for this change
@mroeschke can you please review this PR?
@mroeschke can you please review this? I have updated the test cases.
@mroeschke pinging on green.
@mroeschke @MarcoGorelli can one of you please review this?
Thanks for your PR!

> @mroeschke @MarcoGorelli can one of you please review this?

Just as a heads up, I'm not familiar with strings - I can take a look, but I'm afraid I'll need to prioritise other things first
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.