Closed MordorianGuy closed 1 year ago
A multimethod is a dict
, which it's interpreting as a mapper instead of a function.
821 if isinstance(mapper, dict) and hasattr(mapper, "__missing__"):
822 # If a dictionary subclass defines a default value method,
823 # convert mapper to a lookup function (GH #15999).
824 dict_with_default = mapper
--> 825 mapper = lambda x: dict_with_default[x]
So I think it's just incompatible goals. You could use test_multimethod.__call__
as a workaround, if you prefer that to lambda
.
I have found a strange behaviour if we put
multimethod
objects as functions in appropriate methods ofpandas
objects.Hereinabove gives the result:
In the case of
transform
we get aDataFrame
:map
raises the next exception:Using it in a simple
lambda
workaround (lamda x: test_multimethod(x)
) makes no worry & works as expected.