diff --git a/pandas/core/arraylike.py b/pandas/core/arraylike.py index e505d97d04a47..3b7eab91fff10 100644 --- a/pandas/core/arraylike.py +++ b/pandas/core/arraylike.py @@ -247,6 +247,8 @@ def array_ufunc(self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any) -------- numpy.org/doc/stable/reference/arrays.classes.html#numpy.class.__array_ufunc__ """ + from pandas import DataFrame + from pandas import Series from pandas.core.generic import NDFrame from pandas.core.internals import BlockManager @@ -295,7 +297,7 @@ def array_ufunc(self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any) # so this ends up just being x1.index | x2.index, but we write # it to handle *args. - if len(set(types)) > 1: + if (any([t is DataFrame for t in types]) and any([t is Series for t in types])): # We currently don't handle ufunc(DataFrame, Series) # well. Previously this raised an internal ValueError. We might # support it someday, so raise a NotImplementedError.