You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by "amoeba (via GitHub)" <gi...@apache.org> on 2024/10/08 22:38:01 UTC

Re: [I] Wrong example of `Struct Layout` [arrow-site]

amoeba commented on issue #546:
URL: https://github.com/apache/arrow-site/issues/546#issuecomment-2400938854

   Hi @doki23, thanks for filing an issue. It looks like you figured out what's going on in the example and the principle it's trying to show. In case it helps at all, here's PyArrow code that shows the same idea:
   
   ```python
   In [1]: import pyarrow as pa
      ...:
   
   In [2]: arr = pa.StructArray.from_arrays(
      ...:     [['joe', None, 'alice', 'mark'], [1, 2, None, 4]],
      ...:     fields=[('a', pa.utf8()), ('b', pa.int64())],
      ...:     mask=pa.array([False, False, True, False], pa.bool_())
      ...: )
   
   In [3]: arr.to_pandas()
   Out[3]:
   0     {'a': 'joe', 'b': 1.0}
   1      {'a': None, 'b': 2.0}
   2                       None
   3    {'a': 'mark', 'b': 4.0}
   dtype: object
   ```


-- 
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: commits-unsubscribe@arrow.apache.org

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