Skip to content

Commit

Permalink
fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlandry committed Oct 19, 2024
1 parent 4dc1f70 commit 6ceba6e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions xgi/stats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,23 @@ def ashist(self, bins=10, bin_edges=False, density=False, log_binning=False):

def max(self):
"""The maximum value of this stat."""
return float(self.asnumpy().max(axis=0))
return self.asnumpy().max(axis=0).item()

def min(self):
"""The minimum value of this stat."""
return float(self.asnumpy().min(axis=0))
return self.asnumpy().min(axis=0).item()

def sum(self):
"""The sum of this stat."""
return float(self.asnumpy().sum(axis=0))
return self.asnumpy().sum(axis=0).item()

def mean(self):
"""The arithmetic mean of this stat."""
return float(self.asnumpy().mean(axis=0))
return self.asnumpy().mean(axis=0).item()

def median(self):
"""The median of this stat."""
return float(np.median(self.asnumpy(), axis=0))
return np.median(self.asnumpy(), axis=0).item()

def std(self):
"""The standard deviation of this stat.
Expand All @@ -231,7 +231,7 @@ def std(self):
See https://www.allendowney.com/blog/2024/06/08/which-standard-deviation/
for more details.
"""
return float(self.asnumpy().std(axis=0))
return self.asnumpy().std(axis=0).item()

def var(self):
"""The variance of this stat.
Expand All @@ -243,7 +243,7 @@ def var(self):
See https://www.allendowney.com/blog/2024/06/08/which-standard-deviation/
for more details.
"""
return float(self.asnumpy().var(axis=0))
return self.asnumpy().var(axis=0).item()

def moment(self, order=2, center=False):
"""The statistical moments of this stat.
Expand All @@ -258,7 +258,7 @@ def moment(self, order=2, center=False):
"""
arr = self.asnumpy()
return (
float(spmoment(arr, moment=order)) if center else float(np.mean(arr**order))
spmoment(arr, moment=order) if center else np.mean(arr**order).item()
)

def argmin(self):
Expand Down

0 comments on commit 6ceba6e

Please sign in to comment.