Skip to content

Add KeyData.train_index_bounds#704

Open
philsmt wants to merge 2 commits intomasterfrom
feat/keydata-train-index
Open

Add KeyData.train_index_bounds#704
philsmt wants to merge 2 commits intomasterfrom
feat/keydata-train-index

Conversation

@philsmt
Copy link
Contributor

@philsmt philsmt commented Dec 19, 2025

When using data with more than one entry per train, I find it sometimes convenient (and also regularly more performant) to use plain old ndarrays and have arrays lying around indicating the first and last index of a given train.

This PR adds a method KeyData.train_index_bounds() to deliver this based on KeyData.data_counts(). I went with the traditional labelled approach, though I don't have hard feelings for that.

@philsmt philsmt requested a review from takluyver December 19, 2025 10:41
@takluyver
Copy link
Member

If this fits in with using .ndarray(), how about we make labelled=False the default? I quite like having a convenient way to do lower-level analysis without involving pandas/xarray, and this seems like it would be a natural part of that.

@philsmt philsmt force-pushed the feat/keydata-train-index branch from 8857c23 to b9daf72 Compare January 26, 2026 10:13
@philsmt
Copy link
Contributor Author

philsmt commented Jan 26, 2026

Sure, I switched the default to labelled=False.

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 this pull request may close these issues.

2 participants