Closed
Description
NDFrame.align
is annotated as def align(self: NDFrameT, other: NDFrameT, ...) -> NDFrameT:
but actually other
does not need to match self
and it usually returns a tuple[Self, type(other)]
. The "usually" is because when broadcast_axis==1 and self.ndim != other.ndim
it returns tuple[DataFrame, DataFrame]
(xref #51856 id like to deprecate this special case).
I tried annotating this correctly and got 40ish complaints e.g pandas/core/generic.py:8994: error: Cannot determine type of "index" [has-type]