Skip to content

Allowing tracking of non-consecutive forager indices#168

Merged
dimkab merged 29 commits intomainfrom
tlb-dev
Jun 27, 2025
Merged

Allowing tracking of non-consecutive forager indices#168
dimkab merged 29 commits intomainfrom
tlb-dev

Conversation

@tommybotch
Copy link
Contributor

Addressing #163

Currently operations over the dataObj require consecutive forager indices. Given situations where subsets of foragers may be of interest (or those with missing data), the foragers may not always have consecutive indices.

Solved by adding a new column to dataObj.foragersDF that re-indexs the foragers column to be consecutive while retaining the original forager index in a new column dataObj.foragersDF.global_forager_id. This column is only created if it does not already exist in the dataframe.

…ping track of non-consecutive forager ids. when instantiating the object, it retains the original forager ids in a new column **only if** the global_forager_id doesn't exist yet
integrating updated workflows into dev branch
@tommybotch tommybotch requested a review from dimkab June 3, 2025 19:55
@tommybotch
Copy link
Contributor Author

This pull only solves the non-consecutive index when creating the dataObj. Downstream functions that combine dataframes currently take merge using "inner" (e.g., when deriving predictors).

Solution would be to merge using "outer" (i.e., retain all columns of both dataframes).

@tommybotch tommybotch marked this pull request as ready for review June 3, 2025 20:02
Copy link
Collaborator

@dimkab dimkab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@tommybotch tommybotch requested a review from dimkab June 9, 2025 21:17
@tommybotch
Copy link
Contributor Author

Addressed revisions, all tests passing

@tommybotch tommybotch requested a review from dimkab June 11, 2025 19:36
Copy link
Collaborator

@dimkab dimkab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry more requests...

…plitting of foragers, added additional property to see if mapping is necessary, changed apply_forager_id_mapping to private function
@tommybotch tommybotch requested a review from dimkab June 24, 2025 14:24
@dimkab
Copy link
Collaborator

dimkab commented Jun 24, 2025

@tommybotch looks good, can we have a tiny test for the good conscience?

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tommybotch
Copy link
Contributor Author

Example notebook added, tests pass -- ready for review @dimkab

Copy link
Collaborator

@dimkab dimkab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm!

@dimkab dimkab merged commit 839f3fe into main Jun 27, 2025
3 checks passed
@dimkab dimkab linked an issue Jun 27, 2025 that may be closed by this pull request
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.

Allow for non-consecutive forager indices

2 participants