[F] Fix nan in statistics

This commit is contained in:
Azalea (on HyDEV-Daisy)
2022-03-25 04:25:39 -04:00
parent 7d8bb56742
commit 81321d2d17
3 changed files with 3 additions and 2 deletions

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

+1 -1
View File
@@ -1,4 +1,4 @@
import sgs.api
import sgs.calculations
__version__ = '1.0.1'
__version__ = '1.0.2'
+2 -1
View File
@@ -124,6 +124,7 @@ def calc_col_stats(col: np.ndarray) -> Statistics:
:param col: Input column (tested on 1D array)
:return: Statistics
"""
col = col[~numpy.isnan(col)]
q1 = np.quantile(col, 0.25)
q3 = np.quantile(col, 0.75)
return Statistics(
@@ -147,4 +148,4 @@ def calculate_freq_statistics(arr: np.ndarray) -> FrequencyStats:
"""
result = [calc_col_stats(arr[:, i]) for i in range(0, 4)]
return FrequencyStats(*result)
return FrequencyStats(*result)