BUG: fix replace_list by jbrockmendel · Pull Request #27720 · pandas-dev/pandas (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in pandas._typing FrameOrSeries is a typevar of Series and DataFrame. This is not applicable to core.generic.

in #27646 FrameOrSeries is defined as a typevar bound by NDFrame so that a series returns a series, a DataFrame returns a DataFrame, a subclassed DataFrame returns a subclassed DataFrame etc.

NDFrame is a nominal type, so allows any subclass of NDFrame to be returned.