The code for this path is
elif [other_is_not_a_series]:
new_index = self.index
new_values = np.empty(len(new_index), dtype=object)
with np.errstate(all="ignore"):
new_values[:] = [func(lv, other) for lv in self._values]
new_name = self.name
res_values = self.array._cast_pointwise_result(new_values)
return self._constructor(...)
AFAICT this is equivalent to series.map(lambda x: func(x, other)). (Unless maybe map hasn't been updated to use _cast_pointwise_result?). If so, we should deprecate allowing it and tell users to use map.
Comment From: Lakshya-Upadhyaya
Hi! I'd like to work on this. I tested the behavior on pandas 3.0.0.dev0
and confirmed that series.combine(scalar, func) produces the same result
as series.map(lambda x: func(x, scalar)).
I'll add a Pandas4Warning when other is not a Series in Series.combine,
directing users to use map instead. Following the same pattern as #62948.
Does this approach sound correct?
Comment From: jbrockmendel
Wait until there is consensus about doing this