Pint+Pandas+Uncertainties...how would you ... #1604
Unanswered
MichaelTiemannOSC
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have spent the past year working on a tool that integrates production, emissions data from corporates to produce a temperature score based on an Implied Temperature Rise model originating from work by the Bank of England. Pint has been a star of this project.
Recently I added uncertainties as an enhancement. I started down the track of using Measurements instead of Quantity, but a combination of factors made me think the better solution was to simply create Quantity objects with ufloat values as magnitudes. It seems to work nicely and simply.
But now I'm stuck: I rely in renormalizing columns with .astype('pint[some esg unit]'). That's now stopped working with this error message:
*** TypeError: can't convert an affine function (<class 'uncertainties.core.AffineScalarFunc'>) to float; use x.nominal_value
If I build everything around Measurements, then the nominal values and the error terms stay very much in their own lanes, and I might be able to get away with the kind of renormalizations the code depends on. But Measurements have other problems (np.isnan and unp.isnan are cool with Quantities, but not Measurements).
High-level thoughts on how to start knocking this problem down?
Beta Was this translation helpful? Give feedback.
All reactions