pint
pint copied to clipboard
Implement broadcast arrays
- [x] Improves #981
- [x] Executed
pre-commit run --all-files
with no errors - [x] The change is fully covered by automated unit tests
- [x] Documented in docs/ as appropriate
- [x] Added an entry to the CHANGES file
I think I need this. I want to be able to broadcast a quantity to a dataframe thusly:
x['foo'] = Q_(1.0, ureg('m'))
Presently I get this error message:
TypeError: object of type 'int' has no len()
If I manually create a PintArray based on the length of X and do some extra work I can cause my scalar quantity to become part of the X dataframe. But a broadcast feature would be wonderful.
@hgrecco - the previous tests failed on install of uncertainties==3.0.1
TypeError: object of type 'int' has no len()
Note that you can work around this by setting ureg.force_ndarray_like = True
or ureg.force_ndarray = True
@hgrecco this seems to be passing and ready to merge - any other comments?