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

Position-based vs label-based indexing #15

Closed
eivindtostesen opened this issue Sep 5, 2023 · 1 comment · Fixed by #20
Closed

Position-based vs label-based indexing #15

eivindtostesen opened this issue Sep 5, 2023 · 1 comment · Fixed by #20

Comments

@eivindtostesen
Copy link
Owner

eivindtostesen commented Sep 5, 2023

The data set Y could be, for example, a time series of stock prices. The P = PeakTree(Y) object is a tree structure that describes features of Y.

Position-based vs label-based indexing is an issue in three cases:

  1. Y has an integer index, but it also has labels, for example time stamps.
  2. P has internal data as dicts, and each dict has both keys and integer positions (available as P._index).
  3. Peaks are located by starts and stops that can be either integers (as in slices of Y) or labels (pairs of time stamps).

In previous versions

  • The idea was that all indexing should be label-based, since integer positions would be tied to the Y array and not be robust to resampling of the data.
  • Starts and stops should not be necessary to compute, but possible.
  • P's dict keys was argmin labels, which approximately located the peaks.

In future versions, maybe

  • Starts and stops are computed by default. Easier to understand than argmin positions.
  • Integer slice notation will be used to locate peaks, by default. Much more lightweight than pairs of time stamps. But requires Y for reference.
  • P dict keys can be changed freely
  • Label-based indexing of Y should not be expected, but possible
@eivindtostesen
Copy link
Owner Author

There is a somewhat similar issue in pandas development.

Quote: "We propose that it should only work with positional indexing, and the translation of keys to positions should be entirely done at a higher level."

@eivindtostesen eivindtostesen linked a pull request Oct 16, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant