Skip to content

Commit 7b855c1

Browse files
authored
DOC: Add explanation how to convert arrow table to pandas df (pandas-dev#51762)
1 parent f9be5d9 commit 7b855c1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/source/user_guide/pyarrow.rst

+12
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ the pyarrow array constructor on the :class:`Series` or :class:`Index`.
7676
idx = pd.Index(ser)
7777
pa.array(idx)
7878
79+
To convert a :external+pyarrow:py:class:`pyarrow.Table` to a :class:`DataFrame`, you can call the
80+
:external+pyarrow:py:meth:`pyarrow.Table.to_pandas` method with ``types_mapper=pd.ArrowDtype``.
81+
82+
.. ipython:: python
83+
84+
table = pa.table([pa.array([1, 2, 3], type=pa.int64())], names=["a"])
85+
86+
df = table.to_pandas(types_mapper=pd.ArrowDtype)
87+
df
88+
df.dtypes
89+
90+
7991
Operations
8092
----------
8193

0 commit comments

Comments
 (0)