pint icon indicating copy to clipboard operation
pint copied to clipboard

Remove __array__ interface

Open coroa opened this issue 2 years ago • 2 comments

  • [ ] Closes https://github.com/hgrecco/pint-pandas/issues/174
  • [x] Executed pre-commit run --all-files with no errors
  • [x] The change is fully covered by automated unit tests
  • [ ] ~Documented in docs/ as appropriate~
  • [ ] Added an entry to the CHANGES file

In hunting down options to address https://github.com/hgrecco/pint-pandas/issues/174 , the only solution i found so far to reliably work was to get rid of the __array__ interface entirely, as a more extreme version of the discussion in https://github.com/hgrecco/pint/issues/1128 .

I was quite surprised to learn that nothing in pint directly depends on the interface, but i guess it would be too much of a breaking change. Nevertheless, I like the idea of pint not ever implictly stripping units.

More realistically this means a proper implementation of the __array_ufunc__ alternative might solve at least the linked issue.

I guess you all are exhausted by these discussion already, sorry that i am pbb missing all the basics.

coroa avatar May 13 '23 09:05 coroa

This is interesting, the main issues we've had previously was due to a pint scalar Q(1,"m") being treated as iterable since it has a iter method, which pandas looked for to determine whether an object was array like. The iter would fail, but pandas was checking whether it exsists not whether it fails.

This is interesting as you've removed array not iter.

andrewgsavage avatar Jun 05 '23 17:06 andrewgsavage

can close this since reductions now work for pint-pandas

andrewgsavage avatar Oct 13 '23 16:10 andrewgsavage