Ordinal encoder not encoding missing values as np.nan

### Describe the bug

The documentation for OrdinalEncoder states that the default encoded_missing_value value is np.nan but when I run the encoder, it replace missing values with -9223372036854775808. The same behaviour is seen even if I manually specify the argument to be np.nan. The same behaviour is also seen for the unknown_value argument when handle_unknown is set to "use_encoded_value". This again is resulting in -9223372036854775808, even when the value np.nan is specified.



### Steps/Code to Reproduce

trainX = np.array(['test', 'check', 'another_test', ''])
testX = np.array(['check', 'yet_another_test', 'test', ''])
trainX = pd.Series(trainX)
trainX = trainX.replace(["^\s*$"], np.NaN, regex=True)
testX = pd.Series(testX)
testX = testX.replace(["^\s*$"], np.NaN, regex=True)

ordinal_encoder = OrdinalEncoder(
            handle_unknown="use_encoded_value", unknown_value=np.nan
        )

ordinal_encoder.fit(trainX.values.reshape(-1, 1))
trainX = ordinal_encoder.transform(
            trainX.values.reshape(-1, 1)
        ).astype("int")
testX = ordinal_encoder.transform(
            testX.values.reshape(-1, 1)
        ).astype("int")
print(testX)
print(trainX)

### Expected Results

Expected results are that the second and last value in testX is encoded as np.nan and the last value in trainX is encoded as np.nan.

### Actual Results

Unable to upload screenshot.

Output shows the second and last value in testX and the last value in trainX are encoded as -9223372036854775808.

trainX: array([[                   2],
       [                   1],
       [                   0],
       [-9223372036854775808]])

testX: array([[                   1],
       [-9223372036854775808],
       [                   2],
       [-9223372036854775808]]

### Versions

```shell
System:
    python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:56:21)  [GCC 10.3.0]
executable: /opt/conda/envs/myenv/bin/python
   machine: Linux-4.14.301-224.520.amzn2.x86_64-x86_64-with-glibc2.28

Python dependencies:
      sklearn: 1.1.3
          pip: 22.3
   setuptools: 65.5.0
        numpy: 1.22.4
        scipy: 1.8.1
       Cython: None
       pandas: 1.4.4
   matplotlib: 3.5.3
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /opt/conda/envs/myenv/lib/libopenblasp-r0.3.21.so
        version: 0.3.21
threading_layer: pthreads
   architecture: SkylakeX
    num_threads: 2

       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /opt/conda/envs/myenv/lib/libgomp.so.1.0.0
        version: None
    num_threads: 2
```

COMMENT:
The output of `OrdinalEncoder` gives the correct NumPy array with the `nans`:

```python
trainX = np.array(['test', 'check', 'another_test', ''])
testX = np.array(['check', 'yet_another_test', 'test', ''])
trainX = pd.Series(trainX)
trainX = trainX.replace(["^\s*$"], np.NaN, regex=True)

testX = pd.Series(testX)
testX = testX.replace(["^\s*$"], np.NaN, regex=True)

ordinal_encoder = OrdinalEncoder(
    handle_unknown="use_encoded_value", unknown_value=np.nan)

ordinal_encoder.fit(trainX.values.reshape(-1, 1))

output = ordinal_encoder.transform(testX.values.reshape(-1, 1))
print(output)
# [[ 1.]
# [nan]
# [ 2.]
# [nan]]
```

The issue in your code snippet is that converting to `int` at the end will not work because `ints` does not define a `nan` value. On my system the conversion returns 0, on others it can return a large negative number.

```python
print(output.astype("int"))
#[[1]
# [0]
# [2]
# [0]]
```

Pandas does support a nullable integer type, so the following would store the nans correctly:

```python
pd.DataFrame(output, dtype="Int32")
```

Labels: Bug, Needs Triage