TST: Nan must not be converted to string using .loc
State: closed

- [X] Closes #28403
- [X] tests added / passed
- [X] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit) for how to run them


Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
ci checks are failing,
however error seems unrelated

```
Run ci/code_checks.sh typing
mypy --version
mypy 0.931
Performing static analysis using mypy
pandas/core/internals/blocks.py:1142: error: Argument 1 to "np_can_hold_element" has incompatible type "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"  [arg-type]
```

Running mypy at the file confirm the error, and the CI yields an even more errors.
```
> mypy  pandas/core/internals/blocks.py
pandas/core/internals/blocks.py:389: error: Unused "type: ignore" comment
pandas/core/internals/blocks.py:1142: error: Argument 1 to "np_can_hold_element" has incompatible type "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"  [arg-type]
Found 2 errors in 1 file (checked 1 source file)
```


```
> ./ci/code_checks.sh typing
mypy --version
mypy 0.930
Performing static analysis using mypy
pandas/core/internals/ops.py:128: error: No overload variant of "__getitem__" of "ExtensionArray" matches argument type "Tuple[int, slice]"  [call-overload]
...
pandas/core/internals/blocks.py:389: error: Unused "type: ignore" comment
pandas/core/internals/blocks.py:1142: error: Argument 1 to "np_can_hold_element" has incompatible type "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"  [arg-type]
...
Performing static analysis using mypy DONE

```

Should a new Issue about this be added? I would happily work on that

> ci checks are failing, however error seems unrelated
> 
> ```
> Run ci/code_checks.sh typing
> mypy --version
> mypy 0.931
> Performing static analysis using mypy
> pandas/core/internals/blocks.py:1142: error: Argument 1 to "np_can_hold_element" has incompatible type "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"  [arg-type]
> ```
> 
> Running mypy at the file confirm the error, and the CI yields an even more errors.
> 
> ```
> > mypy  pandas/core/internals/blocks.py
> pandas/core/internals/blocks.py:389: error: Unused "type: ignore" comment
> pandas/core/internals/blocks.py:1142: error: Argument 1 to "np_can_hold_element" has incompatible type "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"  [arg-type]
> Found 2 errors in 1 file (checked 1 source file)
> ```
> 
> ```
> > ./ci/code_checks.sh typing
> mypy --version
> mypy 0.930
> Performing static analysis using mypy
> pandas/core/internals/ops.py:128: error: No overload variant of "__getitem__" of "ExtensionArray" matches argument type "Tuple[int, slice]"  [call-overload]
> ...
> pandas/core/internals/blocks.py:389: error: Unused "type: ignore" comment
> pandas/core/internals/blocks.py:1142: error: Argument 1 to "np_can_hold_element" has incompatible type "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"  [arg-type]
> ...
> Performing static analysis using mypy DONE
> ```
> 
> Should a new Issue about this be added? I would happily work on that

Yup this is unrelated. Looks like it originated from https://github.com/pandas-dev/pandas/pull/45792 cc @jbrockmendel 
Would be happy to take a fix for it unless it's already being addressed in the meantime.
Thanks for all your work closing these regression tests @NumberPiOso! Happy to have more!