`precision_recall_fscore_support` with `zero_division=np.nan` assigns F1-score as `0` instead of `np.nan​`

### Describe the bug

According to docs:
```
zero_division : {"warn", 0.0, 1.0, np.nan}, default="warn"
        Sets the value to return when there is a zero division, i.e. when all
        predictions and labels are negative.

        Notes:
        - If set to "warn", this acts like 0, but a warning is also raised.
        - If set to `np.nan`, such values will be excluded from the average.

        .. versionadded:: 1.3
           `np.nan` option was added.
```

However, when using the `precision_recall_fscore_support` function with the parameter zero_division set to `np.nan`, the expected behavior would be that undefined precision or recall values result in an F1-score of `np.nan`. However, the function currently assigns an F1-score of `0` in these cases.​


### Steps/Code to Reproduce

```python
from sklearn.metrics import precision_recall_fscore_support
import numpy as np

# Define true labels and predictions
y_true = [0, 1, 0, 3]  # True labels (my original dataset contains labels from 0 to 3)-- for this specific subset the label 2 didn't appear
y_pred = [0, 1, 2, 2]  # Predicted labels

# Calculate precision, recall, and F1 score with zero_division set to np.nan
precision, recall, f1, support = precision_recall_fscore_support(
    y_true, y_pred, zero_division=np.nan, average=None
)

# Output the results
print("Precision per class:", precision)
print("Recall per class:", recall)
print("F1-score per class:", f1)
```

### Expected Results

```
Precision per class: [1.   1.   0.   nan]
Recall per class:    [0.5  1.   nan  0. ]
F1-score per class:  [0.6667  1.      nan  nan]
```

### Actual Results

```
Precision per class: [ 1.  1.  0. nan]
Recall per class: [0.5 1.  nan 0. ]
F1-score per class: [0.66666667 1.         0.         0.        ]
```

### Versions

```shell
System:
    python: 3.12.8 (main, Jan 14 2025, 22:49:36) [MSC v.1942 64 bit (AMD64)]
executable: C:\workspace\learning\jbcs2025\.venv\Scripts\python.exe
   machine: Windows-11-10.0.22621-SP0

Python dependencies:
      sklearn: 1.6.1
          pip: None
   setuptools: 76.0.0
        numpy: 2.2.3
        scipy: 1.15.2
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.10.1
       joblib: 1.4.2
threadpoolctl: 3.6.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: vcomp
       filepath: C:\workspace\learning\jbcs2025\.venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libscipy_openblas
       filepath: C:\workspace\learning\jbcs2025\.venv\Lib\site-packages\numpy.libs\libscipy_openblas64_-43e11ff0749b8cbe0a615c9cf6737e0e.dll        
        version: 0.3.28
threading_layer: pthreads
   architecture: Haswell

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libscipy_openblas
       filepath: C:\workspace\learning\jbcs2025\.venv\Lib\site-packages\scipy.libs\libscipy_openblas-f07f5a5d207a3a47104dca54d6d0c86a.dll
        version: 0.3.28
threading_layer: pthreads
   architecture: Haswell
```

COMMENT:
Can I take this one if it needs to be fixed?

Labels: Bug, Needs Triage