Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

from bigframes import constants

# TODO(huanc): Remove "doctest: +SKIP" from this file after the struct ordering
# issue b/362738764 is fixed


class StructAccessor:
"""
Expand Down Expand Up @@ -41,7 +44,7 @@ def field(self, name_or_index: str | int):

Extract by field index.

>>> s.struct.field(0)
>>> s.struct.field(0) # doctest: +SKIP
0 1
1 2
2 1
Expand Down Expand Up @@ -79,7 +82,7 @@ def explode(self):

Extract all child fields.

>>> s.struct.explode()
>>> s.struct.explode() # doctest: +SKIP
version project
0 1 pandas
1 2 pandas
Expand Down Expand Up @@ -112,7 +115,7 @@ def dtypes(self):
... [("version", pa.int64()), ("project", pa.string())]
... ))
... )
>>> s.struct.dtypes()
>>> s.struct.dtypes() # doctest: +SKIP
version Int64
project string[pyarrow]
dtype: object
Expand Down Expand Up @@ -150,7 +153,7 @@ def explode(self, column, *, separator: str = "."):
... )
>>> downloads = bpd.Series([100, 200, 300])
>>> df = bpd.DataFrame({"country": countries, "file": files, "download_count": downloads})
>>> df.struct.explode("file")
>>> df.struct.explode("file") # doctest: +SKIP
country file.version file.project download_count
0 cn 1 pandas 100
1 es 2 pandas 200
Expand Down