-
Notifications
You must be signed in to change notification settings - Fork 479
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
how to avoid float/int casting error with to_reduced_units() on integer arrays #1184
Labels
Comments
jules-ch
added a commit
to jules-ch/pint
that referenced
this issue
Nov 18, 2021
Do not use ito with to_reduced function
jules-ch
added a commit
to jules-ch/pint
that referenced
this issue
Nov 18, 2021
Do not use ito with to_reduced function
jules-ch
added a commit
to jules-ch/pint
that referenced
this issue
Nov 18, 2021
Do not use ito with to_reduced function
jules-ch
added a commit
to jules-ch/pint
that referenced
this issue
Nov 23, 2021
Do not use ito with to_reduced function
jules-ch
added a commit
to jules-ch/pint
that referenced
this issue
Nov 23, 2021
Do not use ito with to_reduced function
jules-ch
added a commit
to jules-ch/pint
that referenced
this issue
Jan 15, 2022
Do not use ito with to_reduced function
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the best approach to avoid casting errors when working with integer arrays? Is there any way to enforce casting to
float
for unit conversions?The following example works with
to_base_units()
on all inputs but fails withto_reduced_units()
once any kind of array gets introduced:to_reduced_units()
seems callito_reduced_units()
almost immediately which produces the error.With
force_ndarray_like=True
it obviously stops working for scalar inputs as well.If possible I would like to catch this behavior as early as possible because it can be quite confusing for new users who might not consider explicitly casting their inputs as
float
and encounter this error at some later point during their analysis.The text was updated successfully, but these errors were encountered: