Skip to content

Commit

Permalink
Added named_arrays.AbstractArray.var() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Feb 18, 2025
1 parent ccc07cc commit 5ca3fbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions named_arrays/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,13 @@ def std(
) -> Self:
return np.std(self, axis=axis, where=where)

def var(
self: Self,
axis: None | str | Sequence[str] = None,
where: Self = np._NoValue,
) -> Self:
return np.var(self, axis=axis, where=where)

Check warning on line 825 in named_arrays/_core.py

View check run for this annotation

Codecov / codecov/patch

named_arrays/_core.py#L825

Added line #L825 was not covered by tests

def percentile(
self: Self,
q: int | float | u.Quantity | Self,
Expand Down
6 changes: 6 additions & 0 deletions named_arrays/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,12 @@ def test_std(
):
assert np.array_equal(array.std(), np.std(array))

def test_var(
self,
array: na.AbstractArray,
):
assert np.array_equal(array.var(), np.var(array))

Check warning on line 1203 in named_arrays/tests/test_core.py

View check run for this annotation

Codecov / codecov/patch

named_arrays/tests/test_core.py#L1203

Added line #L1203 was not covered by tests

def test_percentile(
self,
array: na.AbstractArray,
Expand Down

0 comments on commit 5ca3fbd

Please sign in to comment.