[F] Fix nan in statistics
This commit is contained in:
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import sgs.api
|
import sgs.api
|
||||||
import sgs.calculations
|
import sgs.calculations
|
||||||
|
|
||||||
__version__ = '1.0.1'
|
__version__ = '1.0.2'
|
||||||
|
|||||||
+2
-1
@@ -124,6 +124,7 @@ def calc_col_stats(col: np.ndarray) -> Statistics:
|
|||||||
:param col: Input column (tested on 1D array)
|
:param col: Input column (tested on 1D array)
|
||||||
:return: Statistics
|
:return: Statistics
|
||||||
"""
|
"""
|
||||||
|
col = col[~numpy.isnan(col)]
|
||||||
q1 = np.quantile(col, 0.25)
|
q1 = np.quantile(col, 0.25)
|
||||||
q3 = np.quantile(col, 0.75)
|
q3 = np.quantile(col, 0.75)
|
||||||
return Statistics(
|
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)]
|
result = [calc_col_stats(arr[:, i]) for i in range(0, 4)]
|
||||||
|
|
||||||
return FrequencyStats(*result)
|
return FrequencyStats(*result)
|
||||||
|
|||||||
Reference in New Issue
Block a user