Open MichaelTiemannOSC opened 2 years ago
I've not seen any pandas interface tests about interpolation so I think it's an issue to raise in pandas.
From what I gather from https://github.com/pandas-dev/pandas/issues/25508 (a similar issue for timezone-aware columns), the intention is for the base ExtensionBlock.interpolate
is supposed to handle that (it definitely shouldn't just forward to fillna
but at least throw NotImplementedError
). However, it seems that there are open questions around the API between extension types and the base implementation to support interpolate
. It looks like in the datetime-column case, workarounds are being used at the extension type level. Pint-pandas could do that too.
This was an issue in pandas. An interpolate methods has been added to EAs that you can implement. There isn't much by way of testing though.
I added a comment to this Issue in pandas: https://github.com/pandas-dev/pandas/issues/41565
But now I wonder whether it's a Pandas problem (ExtensionArrays implementation of interpolate) or or a Pint-Pandas problem (lack of PintArray implementation of interpolate).
Here's interpolate working as expecting, with float64 as the base type:
Here's it not working with PintArray:
The working
interpolate
function comes from Block.interpolate (in blocks.py) and uses this try clause to muscle through:The non-working
interpolate
function comes from EABackedBlock.interpolate (also in blocks.py), which is just a weak interface tofillna
.Is it Pandas or Pint-Pandas that needs to implement a linear method for the ExtensionArray that is a PintArray?