Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

docs: add documentation for Series.struct.field and Series.struct.explode #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion 2 bigframes/core/indexers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def __getitem__(self, key: tuple) -> bigframes.core.scalar.Scalar:
raise ValueError(error_message)
if len(key) != 2:
raise TypeError(error_message)
block: bigframes.core.blocks.Block = self._dataframe._block
block: bigframes.core.blocks.Block = self._dataframe._block # type: ignore
ashleyxuu marked this conversation as resolved.
Show resolved Hide resolved
column_block = block.select_columns([block.value_columns[key[1]]])
column = bigframes.series.Series(column_block)
return column.iloc[key[0]]
Expand Down
4 changes: 2 additions & 2 deletions 4 bigframes/operations/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import third_party.bigframes_vendored.pandas.core.arrays.arrow.accessors as vendoracessors


class StructField(bigframes.operations.UnaryOp):
class _StructField(bigframes.operations.UnaryOp):
def __init__(self, name_or_index: str | int):
self._name_or_index = name_or_index

Expand All @@ -44,7 +44,7 @@ class StructAccessor(
__doc__ = vendoracessors.StructAccessor.__doc__

def field(self, name_or_index: str | int) -> bigframes.series.Series:
series = self._apply_unary_op(StructField(name_or_index))
series = self._apply_unary_op(_StructField(name_or_index))
if isinstance(name_or_index, str):
name = name_or_index
else:
Expand Down
8 changes: 8 additions & 0 deletions 8 docs/reference/bigframes.pandas/series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ String handling
:members:
:inherited-members:
:undoc-members:

Struct handling
^^^^^^^^^^^^^^^

.. automodule:: bigframes.operations.structs
:members:
:inherited-members:
:undoc-members:
2 changes: 2 additions & 0 deletions 2 docs/templates/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
uid: bigframes.operations.datetimes.DatetimeMethods
- name: StringMethods
uid: bigframes.operations.strings.StringMethods
- name: StructAccessor
uid: bigframes.operations.structs.StructAccessor
name: Series
- name: Window
uid: bigframes.core.window.Window
Expand Down
21 changes: 21 additions & 0 deletions 21 third_party/bigframes_vendored/pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ class Series(NDFrame): # type: ignore[misc]
def dt(self):
"""
Accessor object for datetime-like properties of the Series values.

Returns:
bigframes.operations.datetimes.DatetimeMethods:
An accessor containing datetime methods.

"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

@property
def struct(self):
"""
Accessor object for struct properties of the Series values.

Returns:
bigframes.operations.structs.StructAccessor:
An accessor containing struct methods.

"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -1733,6 +1750,10 @@ def str(self):

NAs stay NA unless handled otherwise by a particular method. Patterned
after Python’s string methods, with some inspiration from R’s stringr package.

Returns:
bigframes.operations.strings.StringMethods:
An accessor containing string methods.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.