Skip to content

Commit a6dab9c

Browse files
authored
docs: add documentation for Series.struct.field and Series.struct.explode (#114)
1 parent ec10c4a commit a6dab9c

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

bigframes/core/indexers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def __getitem__(self, key: tuple) -> bigframes.core.scalar.Scalar:
225225
raise ValueError(error_message)
226226
if len(key) != 2:
227227
raise TypeError(error_message)
228-
block: bigframes.core.blocks.Block = self._dataframe._block
228+
block: bigframes.core.blocks.Block = self._dataframe._block # type: ignore
229229
column_block = block.select_columns([block.value_columns[key[1]]])
230230
column = bigframes.series.Series(column_block)
231231
return column.iloc[key[0]]

bigframes/operations/structs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import third_party.bigframes_vendored.pandas.core.arrays.arrow.accessors as vendoracessors
2626

2727

28-
class StructField(bigframes.operations.UnaryOp):
28+
class _StructField(bigframes.operations.UnaryOp):
2929
def __init__(self, name_or_index: str | int):
3030
self._name_or_index = name_or_index
3131

@@ -44,7 +44,7 @@ class StructAccessor(
4444
__doc__ = vendoracessors.StructAccessor.__doc__
4545

4646
def field(self, name_or_index: str | int) -> bigframes.series.Series:
47-
series = self._apply_unary_op(StructField(name_or_index))
47+
series = self._apply_unary_op(_StructField(name_or_index))
4848
if isinstance(name_or_index, str):
4949
name = name_or_index
5050
else:

docs/reference/bigframes.pandas/series.rst

+8
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ String handling
3434
:members:
3535
:inherited-members:
3636
:undoc-members:
37+
38+
Struct handling
39+
^^^^^^^^^^^^^^^
40+
41+
.. automodule:: bigframes.operations.structs
42+
:members:
43+
:inherited-members:
44+
:undoc-members:

docs/templates/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
uid: bigframes.operations.datetimes.DatetimeMethods
4040
- name: StringMethods
4141
uid: bigframes.operations.strings.StringMethods
42+
- name: StructAccessor
43+
uid: bigframes.operations.structs.StructAccessor
4244
name: Series
4345
- name: Window
4446
uid: bigframes.core.window.Window

third_party/bigframes_vendored/pandas/core/series.py

+21
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ class Series(NDFrame): # type: ignore[misc]
2222
def dt(self):
2323
"""
2424
Accessor object for datetime-like properties of the Series values.
25+
26+
Returns:
27+
bigframes.operations.datetimes.DatetimeMethods:
28+
An accessor containing datetime methods.
29+
30+
"""
31+
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
32+
33+
@property
34+
def struct(self):
35+
"""
36+
Accessor object for struct properties of the Series values.
37+
38+
Returns:
39+
bigframes.operations.structs.StructAccessor:
40+
An accessor containing struct methods.
41+
2542
"""
2643
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
2744

@@ -1733,6 +1750,10 @@ def str(self):
17331750
17341751
NAs stay NA unless handled otherwise by a particular method. Patterned
17351752
after Python’s string methods, with some inspiration from R’s stringr package.
1753+
1754+
Returns:
1755+
bigframes.operations.strings.StringMethods:
1756+
An accessor containing string methods.
17361757
"""
17371758
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
17381759

0 commit comments

Comments
 (0)