-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: Series.sum test case * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test_series_sum refactoring * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixing according to standard * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactoring code to satisfy code criteria * Fixing Series.sum functionality for Pyarrow DF * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixing compare mistake on Series.sum for Pyarrow * cleaning up code * removing 'pyarrow_table' from test_sum_all and test_renamed_taxicab * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * making sure CI passes all test cases * all test cases passed on CI --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
721816f
commit 2bc3a6f
Showing
6 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
import narwhals.stable.v1 as nw | ||
from tests.utils import compare_dicts | ||
|
||
|
||
def test_series_sum(constructor: Any) -> None: | ||
data = { | ||
"a": [0, 1, 2, 3, 4], | ||
"b": [1, 2, 3, 5, 3], | ||
"c": [5, 4, None, 2, 1], | ||
} | ||
df = nw.from_native( | ||
constructor(data), strict=False, eager_only=True, allow_series=True | ||
) | ||
|
||
result = df.select(nw.col("a", "b", "c").sum()) | ||
|
||
expected_sum = {"a": [10], "b": [14], "c": [12]} | ||
|
||
compare_dicts(result, expected_sum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters