75 notebooks#84
Open
dalonsoa wants to merge 2 commits into
Open
Conversation
Author
|
The latest MUSE2 release uses the old file structure, so those tests are failing - but it is for a known reason. |
dc2917
approved these changes
Jul 16, 2026
dc2917
left a comment
There was a problem hiding this comment.
Seems reasonable to me!
is far from ideal from the processing perspective. Performance-wise, there are vectorised options that are faster than apply, but this one was more readable.
I think for a notebook this sounds like a good approach.
Author
|
This is the vectorised version, by the way: # Try merging on asset_id first, then fall back to group_id for unmatched rows
merged = asset_capacities.merge(
assets[["asset_id", "agent_id", "process_id", "commission_year"]],
on="asset_id",
how="left"
)
# Fill in rows where asset_id was None using group_id
mask = merged["agent_id"].isna()
fallback = asset_capacities[mask].merge(
assets[["group_id", "agent_id", "process_id", "commission_year"]],
on="group_id",
how="left"
)
merged.loc[mask, ["agent_id", "process_id", "commission_year"]] = fallback[["agent_id", "process_id", "commission_year"]].values
asset_capacities = merged |
Yeah, it's not that it's unclear, but it does make the process look more cumbersome, even if it's less work for the computer to do. I guess it depends on the purpose of the notebook? |
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.
Description
Update the capacity notebook to account for the new output file structure - which is far from ideal from the processing perspective. Performance-wise, there are vectorised options that are faster than
apply, but this one was more readable.The output plot is:
Close #75
Type of change
Key checklist
python -m pytest)pre-commit run --all-files)Further checks
(Indicate issue here: # (issue))