Skip to content

Replace numpy.split with iloc to get rid of FutureWarning on using Series.swapaxes #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion sensorpush_to_statusdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,27 @@ def summarize_intervals(self, sample_series, limit_type):

interval_points = []
extended_intervals = []
for interval in np.split(sample_series, gap_positions):
# Initialize the starting index for slicing
start_idx = 0
for end_idx in gap_positions:
interval = sample_series.iloc[start_idx:end_idx]
lower = interval.index[0]
upper = interval.index[-1]
interval_points.append((lower, upper))
# Extended interval with 1 hour in each direction
extend_lower = lower - np.timedelta64(1, "h")
extend_upper = upper + np.timedelta64(1, "h")
extended_intervals.append((extend_lower, extend_upper))
start_idx = end_idx

# Capture the last interval
interval = sample_series.iloc[start_idx:]
lower = interval.index[0]
upper = interval.index[-1]
interval_points.append((lower, upper))
extend_lower = lower - np.timedelta64(1, "h")
extend_upper = upper + np.timedelta64(1, "h")
extended_intervals.append((extend_lower, extend_upper))

return interval_points, extended_intervals

Expand Down
Loading