Skip to content

Correct np.nan series percentile handling

Hinman, Elise D requested to merge correct-percentiles into main

This MR addresses an issue that cropped up while building the example notebooks on the add-notebooks branch. The fixed_percentile_from_values function produces a series of np.nan if there aren't sufficient data to calculate percentiles. This was causing an error in calculate_variable_percentile_from_value function, where a percentile series of only np.nans is masked and appears as an empty array. This MR adds code that handles this possibility by returning a value of np.nan when the array is "empty", and adds unit tests for this scenario.

Merge request reports