Skip to content
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

Implement DataFrame.__neg__ #1847

Merged
merged 1 commit into from Oct 13, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions databricks/koalas/frame.py
Expand Up @@ -811,6 +811,9 @@ def __rfloordiv__(self, other):
def __abs__(self):
return self._apply_series_op(lambda kser: abs(kser))

def __neg__(self):
return self._apply_series_op(lambda kser: -kser)

def add(self, other):
return self + other

Expand Down
1 change: 1 addition & 0 deletions databricks/koalas/tests/test_dataframe.py
Expand Up @@ -65,6 +65,7 @@ def test_dataframe(self):
self.assert_eq(kdf.columns, pd.Index(["a", "b"]))

self.assert_eq(kdf[kdf["b"] > 2], pdf[pdf["b"] > 2])
self.assert_eq(-kdf[kdf["b"] > 2], -pdf[pdf["b"] > 2])
self.assert_eq(kdf[["a", "b"]], pdf[["a", "b"]])
self.assert_eq(kdf.a, pdf.a)
self.assert_eq(kdf.b.mean(), pdf.b.mean())
Expand Down