You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
df=df.sort_index().reset_index(drop=True) # retain original row order
# This expands "allregions" into one row for each region:
df["region"] =df["region"].map(
lambdax: regionsifx=="allregions"elsex
)
df=df.explode(["region"])
df["region"] =df["region"].str.upper()
and there's also an explode function in utils.py.
It would be good to have all the code exploding regions in one place, both for code reuse and conciseness but also so that optimizations are applied everywhere.
There's code in
generate_uc_properties
that expandsallregions
and comma-separated region lists:xl2times/xl2times/transforms.py
Lines 749 to 767 in b12287d
which is very similar to code in
process_transform_tables
:xl2times/xl2times/transforms.py
Lines 1708 to 1745 in 3720c7e
and there's also an
explode
function inutils.py
.It would be good to have all the code exploding regions in one place, both for code reuse and conciseness but also so that optimizations are applied everywhere.
(Link to original discussion: https://github.com/etsap-TIMES/xl2times/pull/179/files/4ea76267c9558b3a08d09ec282b7a5fcaa458f8c#r1487242195)
The text was updated successfully, but these errors were encountered: