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

Implement broadcast arrays #1410

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

djpugh
Copy link

@djpugh djpugh commented Nov 6, 2021

  • Improves Numpy Supported functions #981
  • Executed pre-commit run --all-files with no errors
  • The change is fully covered by automated unit tests
  • Documented in docs/ as appropriate
  • Added an entry to the CHANGES file

@MichaelTiemannOSC
Copy link
Collaborator

MichaelTiemannOSC commented Dec 28, 2021

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.

@djpugh
Copy link
Author

djpugh commented Feb 18, 2022

@hgrecco - the previous tests failed on install of uncertainties==3.0.1

@keewis
Copy link
Contributor

keewis commented Mar 15, 2022

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

@djpugh
Copy link
Author

djpugh commented Feb 25, 2024

@hgrecco this seems to be passing and ready to merge - any other comments?

@andrewgsavage
Copy link
Collaborator

@hgrecco this seems to be passing and ready to merge - any other comments?

could you change the line in CHANGES to be for the newest version?

Copy link

codspeed-hq bot commented May 12, 2024

CodSpeed Performance Report

Merging #1410 will not alter performance

Comparing djpugh:implement_broadcast_arrays (87c18c7) with master (24dd237)

Summary

✅ 437 untouched benchmarks

@andrewgsavage
Copy link
Collaborator

I implemented broadcast_arrays after this PR (didn't see this one, my bad)
Looks like the implementation in this PR doesn't work with the test case I made, so this will need looking into

@djpugh
Copy link
Author

djpugh commented Nov 18, 2024

@andrewgsavage, I've not had to use this functionality in a while, although I'm now working on something similar to last time I hit this error (and implemented this). Happy to look at it again if it's still an issue

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.

4 participants