Skip to content

Commit c207851

Browse files
committed
Add whatsnew example
1 parent aa74642 commit c207851

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

doc/source/whatsnew/v1.5.0.rst

+31
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,37 @@ including other versions of pandas.
1414
Enhancements
1515
~~~~~~~~~~~~
1616

17+
.. _whatsnew_150.enhancements.arrow:
18+
19+
Native PyArrow-backed ExtensionArray
20+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
With `Pyarrow <https://arrow.apache.org/docs/python/index.html>`__ installed, users can now create pandas objects
23+
that are backed by a ``pyarrow.ChunkedArray`` and ``pyarrow.DataType``.
24+
25+
The ``dtype`` argument can accept a string of a `pyarrow data type <https://arrow.apache.org/docs/python/api/datatypes.html>`__
26+
with ``pyarrow`` in brackets e.g. ``int64[pyarrow]`` or, for pyarrow data types that take parameters, a :class:`ArrowDtype`
27+
initialized with a ``pyarrow.DataType``
28+
29+
.. ipython:: python
30+
31+
import pyarrow as pa
32+
ser_float = pd.Series([1.0, 2.0, None], dtype="float32[pyarrow]")
33+
ser_float
34+
35+
ser_list = pd.Series([[1, 2]], dtype=pd.ArrowDtype(pa.list_(pa.int64())))
36+
ser_list
37+
38+
Most operations are supported and have been implemented using `pyarrow compute <https://arrow.apache.org/docs/python/api/compute.html>`__ functions.
39+
We recommend installing the latest version of PyArrow to access the most recently implemented compute functions.
40+
41+
.. ipython:: python
42+
43+
ser_list.take([0, 0])
44+
ser_float * 5
45+
ser_float.mean()
46+
ser_float.dropna()
47+
1748
.. _whatsnew_150.enhancements.dataframe_exchange:
1849

1950
DataFrame exchange protocol implementation

0 commit comments

Comments
 (0)