Skip to content

Commit 531ac29

Browse files
authored
DOC: Add pyarrow type equivalency table (#50474)
* DOC: Add pyarrow type equivalency table * Address review * Fix another typo
1 parent 48b3438 commit 531ac29

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

doc/source/reference/arrays.rst

+31
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,37 @@ is an :class:`ArrowDtype`.
6060
`Pyarrow <https://arrow.apache.org/docs/python/index.html>`__ provides similar array and `data type <https://arrow.apache.org/docs/python/api/datatypes.html>`__
6161
support as NumPy including first-class nullability support for all data types, immutability and more.
6262

63+
The table below shows the equivalent pyarrow-backed (``pa``), pandas extension, and numpy (``np``) types that are recognized by pandas.
64+
Pyarrow-backed types below need to be passed into :class:`ArrowDtype` to be recognized by pandas e.g. ``pd.ArrowDtype(pa.bool_())``
65+
66+
=============================================== ========================== ===================
67+
PyArrow type pandas extension type NumPy type
68+
=============================================== ========================== ===================
69+
:external+pyarrow:py:func:`pyarrow.bool_` :class:`BooleanDtype` ``np.bool_``
70+
:external+pyarrow:py:func:`pyarrow.int8` :class:`Int8Dtype` ``np.int8``
71+
:external+pyarrow:py:func:`pyarrow.int16` :class:`Int16Dtype` ``np.int16``
72+
:external+pyarrow:py:func:`pyarrow.int32` :class:`Int32Dtype` ``np.int32``
73+
:external+pyarrow:py:func:`pyarrow.int64` :class:`Int64Dtype` ``np.int64``
74+
:external+pyarrow:py:func:`pyarrow.uint8` :class:`UInt8Dtype` ``np.uint8``
75+
:external+pyarrow:py:func:`pyarrow.uint16` :class:`UInt16Dtype` ``np.uint16``
76+
:external+pyarrow:py:func:`pyarrow.uint32` :class:`UInt32Dtype` ``np.uint32``
77+
:external+pyarrow:py:func:`pyarrow.uint64` :class:`UInt64Dtype` ``np.uint64``
78+
:external+pyarrow:py:func:`pyarrow.float32` :class:`Float32Dtype` ``np.float32``
79+
:external+pyarrow:py:func:`pyarrow.float64` :class:`Float64Dtype` ``np.float64``
80+
:external+pyarrow:py:func:`pyarrow.time32` (none) (none)
81+
:external+pyarrow:py:func:`pyarrow.time64` (none) (none)
82+
:external+pyarrow:py:func:`pyarrow.timestamp` :class:`DatetimeTZDtype` ``np.datetime64``
83+
:external+pyarrow:py:func:`pyarrow.date32` (none) (none)
84+
:external+pyarrow:py:func:`pyarrow.date64` (none) (none)
85+
:external+pyarrow:py:func:`pyarrow.duration` (none) ``np.timedelta64``
86+
:external+pyarrow:py:func:`pyarrow.binary` (none) (none)
87+
:external+pyarrow:py:func:`pyarrow.string` :class:`StringDtype` ``np.str_``
88+
:external+pyarrow:py:func:`pyarrow.decimal128` (none) (none)
89+
:external+pyarrow:py:func:`pyarrow.list_` (none) (none)
90+
:external+pyarrow:py:func:`pyarrow.map_` (none) (none)
91+
:external+pyarrow:py:func:`pyarrow.dictionary` :class:`CategoricalDtype` (none)
92+
=============================================== ========================== ===================
93+
6394
.. note::
6495

6596
For string types (``pyarrow.string()``, ``string[pyarrow]``), PyArrow support is still facilitated

0 commit comments

Comments
 (0)