forbid_nonstring_types(forbidden: 'list[str] | None', name: 'str | None' = None) -> 'Callable[[F], F]'
For calling :None:None:`.str.{method}` on a Series or Index, it is necessary to first initialize the StringMethods
object, and then call the method. However, different methods allow different input types, and so this can not be checked during StringMethods.__init__
, but must be done on a per-method basis. This decorator exists to facilitate this process, and make it explicit which (inferred) types are disallowed by the method.
StringMethods.__init__
allows the union of types its different methods allow (after skipping NaNs; see StringMethods._validate
), namely: ['string', 'empty', 'bytes', 'mixed', 'mixed-integer'].
The default string types ['string', 'empty'] are allowed for all methods. For the additional types ['bytes', 'mixed', 'mixed-integer'], each method then needs to forbid the types it is not intended for.
List of forbidden non-string types, may be one or more of :None:None:`['bytes', 'mixed', 'mixed-integer']`.
Name of the method to use in the error message. By default, this is None, in which case the name from the method being wrapped will be copied. However, for working with further wrappers (like _pat_wrapper and _noarg_wrapper), it is necessary to specify the name.
If the inferred type of the underlying data is in :None:None:`forbidden`.
The method to which the decorator is applied, with an added check that enforces the inferred type to not be in the list of forbidden types.
Decorator to forbid specific types for a method of StringMethods.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them