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

unit not updated when multiplying by rate #409

Closed
bl-young opened this issue May 15, 2024 · 0 comments · Fixed by #411
Closed

unit not updated when multiplying by rate #409

bl-young opened this issue May 15, 2024 · 0 comments · Fixed by #411
Labels
invalid This doesn't seem right
Milestone

Comments

@bl-young
Copy link
Collaborator

in attribution_method: multiplication, units are updated when the original data point is a rate, but not the attribution source is a rate

flowsa/flowsa/flowby.py

Lines 1238 to 1254 in 0d44ae9

# set new units, incorporating a check that units are correctly
# converted
rate = None
if fb['Unit'].str.contains('/').all():
rate = 'Unit'
other = 'Unit_other'
elif fb['Unit_other'].str.contains('/').all():
rate = 'Unit_other'
other = 'Unit'
if rate is not None:
fb['Denominator'] = fb[rate].str.split("/").str[1]
fb[rate] = fb[rate].str.split("/").str[0]
if fb[other].equals(fb['Denominator']) is False:
log.warning('Check units being multiplied')
else:
log.info(f"Units reset to"
f" {fb[rate].drop_duplicates().tolist()}")

@bl-young bl-young added the invalid This doesn't seem right label May 15, 2024
@bl-young bl-young linked a pull request May 24, 2024 that will close this issue
@bl-young bl-young added this to the 2.0.2 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant