[
https://issues.apache.org/jira/browse/ARROW-8851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Francois Saint-Jacques reassigned ARROW-8851:
---------------------------------------------
Assignee: Weston Steimel
> [Python][Documentation] Fix FutureWarnings in Python Plasma docs
> ----------------------------------------------------------------
>
> Key: ARROW-8851
> URL: https://issues.apache.org/jira/browse/ARROW-8851
> Project: Apache Arrow
> Issue Type: Improvement
> Components: Documentation, Python
> Affects Versions: 0.17.0
> Reporter: Weston Steimel
> Assignee: Weston Steimel
> Priority: Trivial
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The documentation for Plasma in Python at
> [https://arrow.apache.org/docs/python/plasma.html] produces several
> FutureWarning messages for pyarrow.get_tensor_size, pyarrow.read_tensor and
> pyarrow.write_tensor
> In [9]: import numpy as np
> : import pyarrow as pa
> :
> : # Create a pyarrow.Tensor object from a numpy random 2-dimensional array
> : data = np.random.randn(10, 4)
> : tensor = pa.Tensor.from_numpy(data)
> :
> : # Create the object in Plasma
> : object_id = plasma.ObjectID(np.random.bytes(20))
> : data_size = pa.get_tensor_size(tensor)
> : buf = client.create(object_id, data_size)
> /usr/local/lib/python3.8/site-packages/pyarrow/util.py:39: FutureWarning:
> pyarrow.get_tensor_size is deprecated as of 0.17.0, please use
> pyarrow.ipc.get_tensor_size instead
> warnings.warn(msg, FutureWarning)
> In [10]: # Write the tensor into the Plasma-allocated buffer
> : stream = pa.FixedSizeBufferWriter(buf)
> : pa.write_tensor(tensor, stream) # Writes tensor's 552 bytes to Plasma
> stream
> /usr/local/lib/python3.8/site-packages/pyarrow/util.py:39: FutureWarning:
> pyarrow.write_tensor is deprecated as of 0.17.0, please use
> pyarrow.ipc.write_tensor instead
> warnings.warn(msg, FutureWarning)
> In [13]: # Reconstruct the Arrow tensor object.
> : reader = pa.BufferReader(buf2)
> : tensor2 = pa.read_tensor(reader)
> /usr/local/lib/python3.8/site-packages/pyarrow/util.py:39: FutureWarning:
> pyarrow.read_tensor is deprecated as of 0.17.0, please use
> pyarrow.ipc.read_tensor instead
> warnings.warn(msg, FutureWarning)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)