Skip to content
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

Clarification on Breakpoint Indexing with Dataframe Input #313

Closed
tg12 opened this issue Nov 3, 2023 · 2 comments
Closed

Clarification on Breakpoint Indexing with Dataframe Input #313

tg12 opened this issue Nov 3, 2023 · 2 comments

Comments

@tg12
Copy link

tg12 commented Nov 3, 2023

I am currently working with a system that utilizes breakpoints, potentially sourced from a pandas DataFrame, and I have encountered a point of confusion regarding the indexing of these breakpoints.

Could you please clarify whether the breakpoints are 0-indexed? Specifically, when breakpoints are loaded from a list obtained from a DataFrame, does the indexing follow the standard Python convention, where the first element is at index 0?

For example, if I have a DataFrame with n rows and I convert it to a list of breakpoints, should I expect that the last breakpoint corresponds to the last element at index n-1, following zero-based indexing?

Understanding this will ensure proper handling of edge cases when the last breakpoint is accessed or modified.

@deepcharles
Copy link
Owner

Hi,

Everything is 0-indexed. For instance, for a numpy array signal of shape (n_samples, n_dims) or (n_samples,), if the change-point list is [10, 45, 89, 100], this means that signal[0:10], signal[10:45], signal[45:89] and signal[89:100] are segments. Also, the last element of a change-point list is the number of samples, i.e. n_samples=100 here.

Hope this helps

@tg12
Copy link
Author

tg12 commented Nov 24, 2023

Perfect thank you!

@tg12 tg12 closed this as completed Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants