Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The reason why mypy and the "apply" function of "Series" reject the use of "set[Any]" as a return object is because "set[Any]" is not a valid return type. "set[Any]" is an ambiguous type that could contain any possible value, which creates uncertainty about what the function actually returns.

Instead, you should use a more specific type or define a custom type that represents the set of values you expect to be returned. This will help mypy and other tools to check and enforce type correctness in your code.