Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

>>> from pandas.api.extensions import register_extension_dtype
>>> from pandas.core.arrays.floating import FloatingDtype
>>> 
>>> 
>>> @register_extension_dtype
... class Float16Dtype(FloatingDtype):
...     type = np.float16
...     name = "Float16"
... 
>>> pd.DataFrame([1.0, pd.NA, 2.0], dtype="Float16")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".venv/lib/python3.8/site-packages/pandas/core/frame.py", line 737, in __init__
    mgr = ndarray_to_mgr(
  File ".venv/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 318, in ndarray_to_mgr
    return arrays_to_mgr(values, columns, index, dtype=dtype, typ=typ)
  File ".venv/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 125, in arrays_to_mgr
    arrays = _homogenize(arrays, index, dtype)
  File ".venv/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 625, in _homogenize
    val = sanitize_array(
  File ".venv/lib/python3.8/site-packages/pandas/core/construction.py", line 591, in sanitize_array
    subarr = _try_cast(data, dtype, copy, raise_cast_failure)
  File ".venv/lib/python3.8/site-packages/pandas/core/construction.py", line 754, in _try_cast
    subarr = array_type(arr, dtype=dtype, copy=copy)
  File ".venv/lib/python3.8/site-packages/pandas/core/arrays/floating.py", line 267, in _from_sequence
    return FloatingArray(values, mask)
  File ".venv/lib/python3.8/site-packages/pandas/core/arrays/floating.py", line 258, in __init__
    raise TypeError("FloatingArray does not support np.float16 dtype.")
TypeError: FloatingArray does not support np.float16 dtype.

Issue Description

Because Pandas does not provide a Float16 extension dtype, I tried to implement it myself using register_extension_dtype. However, it seems that there is a hard-coded error message somewhere, blocking me from using np.float16.

Expected Behavior

I would expect users to be able to create their own dtype using np.float16 as a base.

Installed Versions

commit : 06d230151e6f18fdb8139d09abf539867a8cd481 python : 3.8.10.final.0 python-bits : 64 OS : Linux OS-release : 5.4.0-91-generic Version : #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 1.4.1 numpy : 1.22.2 pytz : 2021.3 dateutil : 2.8.2 pip : 20.0.2 setuptools : 44.0.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None