You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AlenkaF (via GitHub)" <gi...@apache.org> on 2023/05/31 06:56:42 UTC

[GitHub] [arrow] AlenkaF opened a new pull request, #35835: GH-33980: [Docs][Python] Document DataFrame Interchange Protocol implementation and usage

AlenkaF opened a new pull request, #35835:
URL: https://github.com/apache/arrow/pull/35835

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] jorisvandenbossche merged pull request #35835: GH-33980: [Docs][Python] Document DataFrame Interchange Protocol implementation and usage

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche merged PR #35835:
URL: https://github.com/apache/arrow/pull/35835


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #35835: GH-33980: [Docs][Python] Document DataFrame Interchange Protocol implementation and usage

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on code in PR #35835:
URL: https://github.com/apache/arrow/pull/35835#discussion_r1219380548


##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,119 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+The Python dataframe interchange protocol is designed by the
+`Consortium for Python Data API Standards <https://data-apis.org/>`_
+in order to enable data interchange between dataframe
+libraries in the Python ecosystem. See more about the
+standard in the
+`protocol documentation <https://data-apis.org/dataframe-protocol/latest/index.html>`_.
+
+From pyarrow to other libraries: ``__dataframe__()`` method
+-----------------------------------------------------------
+
+The ``__dataframe__()`` method creates a new exchange object that
+the consumer library can take and construct an object of it's own.
+
+.. code-block::
+
+    >>> import pyarrow as pa
+    >>> table = pa.table({"n_atendees": [100, 10, 1]})
+    >>> table.__dataframe__()
+    <pyarrow.interchange.dataframe._PyArrowDataFrame object at ...>
+
+This is meant to be used by the consumer library when calling
+``from_dataframe()`` method and is not meant to be used manually
+by the user.
+
+From other libraries to pyarrow: ``from_dataframe()``
+-----------------------------------------------------
+
+With ``from_dataframe()`` method, we can construct a :class:`pyarrow.Table`

Review Comment:
   ```suggestion
   With the ``from_dataframe()`` function, we can construct a :class:`pyarrow.Table`
   ```



##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,119 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+The Python dataframe interchange protocol is designed by the
+`Consortium for Python Data API Standards <https://data-apis.org/>`_
+in order to enable data interchange between dataframe
+libraries in the Python ecosystem. See more about the
+standard in the
+`protocol documentation <https://data-apis.org/dataframe-protocol/latest/index.html>`_.
+
+From pyarrow to other libraries: ``__dataframe__()`` method
+-----------------------------------------------------------
+
+The ``__dataframe__()`` method creates a new exchange object that
+the consumer library can take and construct an object of it's own.
+
+.. code-block::
+
+    >>> import pyarrow as pa
+    >>> table = pa.table({"n_atendees": [100, 10, 1]})
+    >>> table.__dataframe__()
+    <pyarrow.interchange.dataframe._PyArrowDataFrame object at ...>
+
+This is meant to be used by the consumer library when calling
+``from_dataframe()`` method and is not meant to be used manually

Review Comment:
   ```suggestion
   the ``from_dataframe()`` function and is not meant to be used manually
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #35835: GH-33980: [Docs][Python] Document DataFrame Interchange Protocol implementation and usage

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on code in PR #35835:
URL: https://github.com/apache/arrow/pull/35835#discussion_r1211312518


##########
docs/source/python/api/tables.rst:
##########
@@ -46,6 +46,18 @@ Classes
    TableGroupBy
    RecordBatchReader
 
+Dataframe Interchange Protocol
+------------------------------
+
+.. currentmodule:: pyarrow.interchange
+
+.. autosummary::
+   :toctree: ../generated/
+
+   from_dataframe

Review Comment:
   Potential alternative might be to do `interchange.from_dataframe` here, to avoid the currentmodule change back and forth



##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,115 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+Python dataframe interchange protocol is designed by the

Review Comment:
   ```suggestion
   The Python dataframe interchange protocol is designed by the
   ```



##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,115 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+Python dataframe interchange protocol is designed by the
+`Consortium for Python Data API Standards <https://data-apis.org/>`_
+in order to enable data interchange between dataframe
+libraries in the Python ecosystem. See more about the
+standard in the
+`protocol documentation <https://data-apis.org/dataframe-protocol/latest/index.html>`_.
+
+``__dataframe__()`` method
+--------------------------
+
+``__dataframe__()`` method creates a new exchange object that
+the consumer library can take and construct an object of it's own.
+
+.. code-block::
+
+    >>> import pyarrow as pa
+    >>> table = pa.table({"n_atendees": [100, 10, 1]})
+    >>> table.__dataframe__()
+    <pyarrow.interchange.dataframe._PyArrowDataFrame object at ...>
+

Review Comment:
   I would mention here that as a user you typically should not call this manually, but that this will be called by the `from_dataframe` function in the target dataframe library



##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,115 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+Python dataframe interchange protocol is designed by the
+`Consortium for Python Data API Standards <https://data-apis.org/>`_
+in order to enable data interchange between dataframe
+libraries in the Python ecosystem. See more about the
+standard in the
+`protocol documentation <https://data-apis.org/dataframe-protocol/latest/index.html>`_.
+
+``__dataframe__()`` method
+--------------------------
+
+``__dataframe__()`` method creates a new exchange object that
+the consumer library can take and construct an object of it's own.
+
+.. code-block::
+
+    >>> import pyarrow as pa
+    >>> table = pa.table({"n_atendees": [100, 10, 1]})
+    >>> table.__dataframe__()
+    <pyarrow.interchange.dataframe._PyArrowDataFrame object at ...>
+
+from_dataframe() method
+-----------------------
+
+With ``from_dataframe()`` method, we can construct a ``pa.table``

Review Comment:
   ```suggestion
   With ``from_dataframe()`` method, we can construct a :class:`pyarrow.Table`
   ```



##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,115 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+Python dataframe interchange protocol is designed by the
+`Consortium for Python Data API Standards <https://data-apis.org/>`_
+in order to enable data interchange between dataframe
+libraries in the Python ecosystem. See more about the
+standard in the
+`protocol documentation <https://data-apis.org/dataframe-protocol/latest/index.html>`_.
+
+``__dataframe__()`` method

Review Comment:
   Maybe we can make those titles "From pyarrow to other libraries: `__dataframe__()` method" and "From other libraries to pyarrow: `from_dataframe()`"



##########
docs/source/python/interchange_protocol.rst:
##########
@@ -0,0 +1,115 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Dataframe Interchange Protocol
+==============================
+
+The interchange protocol is implemented for ``pa.Table`` and
+``pa.RecordBatch`` and is used to interchange data between
+PyArrow and other dataframe libraries that also have the
+protocol implemented. The data structures that are supported
+in the protocol are primitive data types plus the dictionary
+data type. The protocol also has missing data support and
+it supports chunking, meaning accessing the
+data in “batches” of rows.
+
+
+Python dataframe interchange protocol is designed by the
+`Consortium for Python Data API Standards <https://data-apis.org/>`_
+in order to enable data interchange between dataframe
+libraries in the Python ecosystem. See more about the
+standard in the
+`protocol documentation <https://data-apis.org/dataframe-protocol/latest/index.html>`_.
+
+``__dataframe__()`` method
+--------------------------
+
+``__dataframe__()`` method creates a new exchange object that

Review Comment:
   ```suggestion
   The ``__dataframe__()`` method creates a new exchange object that
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ursabot commented on pull request #35835: GH-33980: [Docs][Python] Document DataFrame Interchange Protocol implementation and usage

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #35835:
URL: https://github.com/apache/arrow/pull/35835#issuecomment-1582515493

   Benchmark runs are scheduled for baseline = dd267572a65272dd01c30a8df15c3b43cf6ba007 and contender = 1d758162044f806cd10d2e7a0953ea31f48a8594. 1d758162044f806cd10d2e7a0953ea31f48a8594 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/638ec75b0f3247a6a849431ab8c1fa54...60c33c4b13604e85a68b3fe8624bedca/)
   [Finished :arrow_down:0.77% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/f88055fad10a4520965e58b1a444941c...d2281a84056e4b3083c31985aef76ac8/)
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/9c12f80519a5426e914974fbc26600db...a2c016fb4c124c70b2d2b44346b078d7/)
   [Finished :arrow_down:0.18% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/750f6d48f3af40ef9fd2b36d065f89c3...1614023b26a4425ba79d976329dfc0fc/)
   Buildkite builds:
   [Finished] [`1d758162` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2998)
   [Finished] [`1d758162` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/3034)
   [Finished] [`1d758162` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2999)
   [Finished] [`1d758162` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/3024)
   [Finished] [`dd267572` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2997)
   [Finished] [`dd267572` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/3033)
   [Finished] [`dd267572` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2998)
   [Finished] [`dd267572` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/3023)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org