chore(state datapoints): Fix state datapoints getitem, slicing and iteration - #2824
Open
haakonvt wants to merge 8 commits into
Open
chore(state datapoints): Fix state datapoints getitem, slicing and iteration#2824haakonvt wants to merge 8 commits into
haakonvt wants to merge 8 commits into
Conversation
haakonvt
force-pushed
the
fix-state-dps-getitem-and-iteration
branch
from
September 7, 2026 20:05
bbb024a to
72155c4
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for state datapoints (numeric and string states) in Datapoints and DatapointsArray, including plural-to-singular key mapping and handling of missing values (NaN to None). It also adds corresponding unit tests. The feedback suggests optimizing the numpy_dtype_fix function by checking for None early to avoid exception overhead in performance-critical loops.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## add-state-ts-retrieve-arrays-support #2824 +/- ##
========================================================================
+ Coverage 93.13% 93.16% +0.03%
========================================================================
Files 516 516
Lines 53832 53929 +97
========================================================================
+ Hits 50135 50245 +110
+ Misses 3697 3684 -13
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add proper support for state datapoints (
numeric_states,string_states) inDatapointsArrayandDatapoints:__getitem__/slicing, & iteration.Changes:
numeric_statesandstring_statesfields to DatapointsArray initialization and_data_fields()__getitem__()and iteration to:float64arrays back to int (withNaN->None)numeric_states→numeric_state) for singleDatapointobjectsdump()to output singular state keys (numericState/numeric_state) in JSON