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
This repository was archived by the owner on May 7, 2026. It is now read-only.
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
5 changes: 5 additions & 0 deletions 5 bigframes/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,11 @@ def __pos__(self) -> DataFrame:
def __neg__(self) -> DataFrame:
return self._apply_unary_op(ops.neg_op)

def __abs__(self) -> DataFrame:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to add the docstring for this method too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

return self._apply_unary_op(ops.abs_op)

__abs__.__doc__ = abs.__doc__

def align(
self,
other: typing.Union[DataFrame, bigframes.series.Series],
Expand Down
2 changes: 2 additions & 0 deletions 2 bigframes/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,8 @@ def update(self, other: Union[Series, Sequence, Mapping]) -> None:
def __abs__(self) -> Series:
return self.abs()

__abs__.__doc__ = inspect.getdoc(vendored_pandas_series.Series.abs)

def abs(self) -> Series:
return self._apply_unary_op(ops.abs_op)

Expand Down
10 changes: 10 additions & 0 deletions 10 tests/system/small/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2460,6 +2460,16 @@ def test_df_neg(scalars_dfs):
assert_pandas_df_equal(pd_result, bf_result)


def test_df__abs__(scalars_dfs):
scalars_df, scalars_pandas_df = scalars_dfs
bf_result = (
abs(scalars_df[["int64_col", "numeric_col", "float64_col"]])
).to_pandas()
pd_result = abs(scalars_pandas_df[["int64_col", "numeric_col", "float64_col"]])

assert_pandas_df_equal(pd_result, bf_result)


def test_df_invert(scalars_dfs):
scalars_df, scalars_pandas_df = scalars_dfs
columns = ["int64_col", "bool_col"]
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.