Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/notebooks/faster-rpy2-conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ custom converter for :mod:`rpy2` is done in few lines of code.
...: # We build a custom converter that is the default converter
...: # for ipython/jupyter shipping with rpy2, to which we add
...: # rules for Arrow + pandas we just made.
...: conv = rpy2.ipython.rmagic.converter + conv
...: conv = rpy2.ipython.rmagic.default.converter + conv

Our custom converter ``conv`` can be specified as a parameter to
``%%R``:
Expand Down Expand Up @@ -118,7 +118,7 @@ It is also possible to only convert to an Arrow data structure.
...: pa_tbl = pyarrow.Table.from_pandas(dataf)
...: return pyra.converter.py2rpy(pa_tbl)
...:
...: conv2 = rpy2.ipython.rmagic.converter + conv2
...: conv2 = rpy2.ipython.rmagic.default.converter + conv2

.. ipython::

Expand Down
4 changes: 3 additions & 1 deletion rpy2_arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def pyarrow_to_r_recordbatchreader(

stream_ptr = ffi.new('struct ArrowArrayStream*')
obj._export_to_c(_c_ptr_to_int(stream_ptr))
return rarrow.RecordBatchReader['import_from_c'](_rarrow_ptr(stream_ptr))
with robjects.default_converter.context():
r_ptr = _rarrow_ptr(stream_ptr)
return rarrow.RecordBatchReader['import_from_c'](r_ptr)


def rarrow_to_py_recordbatchreader(
Expand Down
Loading