Skip to content

Fix unit conversion #41

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Fix unit conversion #41

wants to merge 6 commits into from

Conversation

SabineHaas
Copy link

No description provided.

Unit is turned back to input unit if conversion does not take place.
Foreign keys are added and converted later.
@SabineHaas SabineHaas requested a review from henhuy December 6, 2024 13:07
@SabineHaas SabineHaas self-assigned this Dec 6, 2024
Copy link
Collaborator

@henhuy henhuy left a comment

Choose a reason for hiding this comment

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

Apart from one part which I don't quite unserstand, I think this is a good solution.

Comment on lines 271 to 273
except TypeError: # occurs for foreign keys
# rewrite unit as conversion did not take place
df_units[field["name"]] = field["unit"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why this is needed? or why a TypeError is thrown.
In line 256 i see the same line, maybe check if conversion can be done should be moved upwards?

Copy link
Author

Choose a reason for hiding this comment

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

Good point. I moved the check upwards, in line with the other checks.
TypeError is thrown because string (foreign key) cannot be multiplied by float.

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