Skip to content

Commit

Permalink
Updated pandas2 items
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhagan committed Oct 3, 2024
1 parent 84054cd commit 61bb112
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions smps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ def make_bins(**kwargs):
if midpoints is not None:
if lb is None or ub is None:
raise Exception("A lower and upper bound must be set")

# Force midpoints to be an array
midpoints = np.asarray(midpoints)

bins = np.empty((midpoints.shape[0], 3))
bins.fill(np.NaN)
bins.fill(np.nan)

# fill the midpoints
bins[:, 1] = midpoints
Expand All @@ -97,7 +100,7 @@ def make_bins(**kwargs):

if boundaries is not None:
bins = np.empty((boundaries.shape[0]-1, 3))
bins.fill(np.NaN)
bins.fill(np.nan)

bins[:, 0] = boundaries[0:-1]
bins[:, 2] = boundaries[1:]
Expand All @@ -110,7 +113,7 @@ def make_bins(**kwargs):
"Boundaries must be the same dimensions."

bins = np.empty((boundaries_left.shape[0], 3))
bins.fill(np.NaN)
bins.fill(np.nan)

bins[:, 0] = boundaries_left
bins[:, 2] = boundaries_right
Expand Down

0 comments on commit 61bb112

Please sign in to comment.