class_docstr: Function wrapper.
  
  A function wrapper which takes a numpy array / pandas series as input and returns
  one or multiple values. It also defines the names of the function outputs, and
  stores the function its keyword arguments.
  
  Parameters
  ----------
  func : Callable
      The wrapped function.
  output_names : Union[List[str], str], optional
      The name of the outputs of the function, by default None.
  input_type: Union[np.array, pd.Series], optional
      The input type that the function requires (either np.array or pd.Series), by
      default np.array.
      .. Note::
          Make sure to only set this argument to pd.Series if the function requires
          a pd.Series, since pd.Series strided-rolling is significantly less efficient.
          For a np.array it is possible to create very efficient views, but there is no
          such thing as a pd.Series view. Thus, for each stroll, a new series is created.
  vectorized: bool, optional
      Flag indicating whether `func` should be executed vectorized over all the
      segmented windows, by default False.
      .. Info::
          A vectorized function should take one or multiple series that each have the
          shape (nb. segmented windows, window size).
          For example a vectorized version of `np.max` is
          ``FuncWrapper(np.max, vectorized=True, axis=1)``.
      .. Note::
          * A function can only be applied in vectorized manner when the required
            series are REGULARLY sampled (and have the same index in case of multiple
            required series).
          * The `input_type` should be `np.array` when `vectorized` is True. It does
            not make sense to use a `pd.Series`, as the index should be regularly
            sampled (see requirement above).
  **kwargs: dict, optional
      Keyword arguments which will be also passed to the `function`
  
  Raises
  ------
  TypeError
      Raised when the `output_names` cannot be set.
class_docstr_tok: ["Function","wrapper",".","A","function","wrapper","which","takes","a","numpy","array","\/","pandas","series","as","input","and","returns","one","or","multiple","values",".","It","also","defines","the","names","of","the","function","outputs",",","and","stores","the","function","its","keyword","arguments",".","Parameters","--","--","--","--","--","func",":","Callable","The","wrapped","function",".","output_names",":","Union","[","List","[","str","]",",","str","]",",","optional","The","name","of","the","outputs","of","the","function",",","by","default","None",".","input_type",":","Union","[","np.array",",","pd.Series","]",",","optional","The","input","type","that","the","function","requires","(","either","np.array","or","pd.Series",")",",","by","default","np.array",".","..","Note",":",":","Make","sure","to","only","set","this","argument","to","pd.Series","if","the","function","requires","a","pd.Series",",","since","pd.Series","strided-rolling","is","significantly","less","efficient",".","For","a","np.array","it","is","possible","to","create","very","efficient","views",",","but","there","is","no","such","thing","as","a","pd.Series","view",".","Thus",",","for","each","stroll",",","a","new","series","is","created",".","vectorized",":","bool",",","optional","Flag","indicating","whether","`","func","`","should","be","executed","vectorized","over","all","the","segmented","windows",",","by","default","False",".","..","Info",":",":","A","vectorized","function","should","take","one","or","multiple","series","that","each","have","the","shape","(","nb",".","segmented","windows",",","window","size",")",".","For","example","a","vectorized","version","of","`","np.max","`","is","``","FuncWrapper","(","np.max",",","vectorized=True",",","axis=1",")","``",".","..","Note",":",":","*","A","function","can","only","be","applied","in","vectorized","manner","when","the","required","series","are","REGULARLY","sampled","(","and","have","the","same","index","in","case","of","multiple","required","series",")",".","*","The","`","input_type","`","should","be","`","np.array","`","when","`","vectorized","`","is","True",".","It","does","not","make","sense","to","use","a","`","pd.Series","`",",","as","the","index","should","be","regularly","sampled","(","see","requirement","above",")",".","*","*","kwargs",":","dict",",","optional","Keyword","arguments","which","will","be","also","passed","to","the","`","function","`","Raises","--","--","--","TypeError","Raised","when","the","`","output_names","`","can","not","be","set","."]
docstr: Create FuncWrapper instance.
docstr_tok: ["Create","FuncWrapper","instance","."]
code: def __init__(
      self,
      func: Callable,
      output_names: Optional[Union[List[str], str]] = None,
      input_type: Optional[Union[np.array, pd.Series]] = np.array,
      vectorized: bool = False,
      **kwargs,
  ):
      """Create FuncWrapper instance."""
      self.func = func
      self.kwargs: dict = kwargs
  
      if isinstance(output_names, list):
          self.output_names = output_names
      elif isinstance(output_names, str):
          self.output_names = [output_names]
      elif not output_names:
          self.output_names = [_get_name(func)]
      else:
          raise TypeError(
              f"`output_names` is unexpected type {type(output_names)}"
          )
  
      assert input_type in SUPPORTED_STROLL_TYPES, "Invalid input_type!"
      assert not (
          vectorized & (input_type is not np.array)
      ), "The input_type must be np.array if vectorized is True!"
      self.input_type = input_type
      self.vectorized = vectorized
  
      self._freeze()
  
file_path: tsflex/tsflex/features/function_wrapper.py
imports: import functools
  from typing import Any, Callable, List, Optional, Union
  import numpy
  import pandas
  from ..None import __pdoc__
  from ..utils.classes import FrozenClass
  from ..utils.data import SUPPORTED_STROLL_TYPES
label_desc: Use image node_id 1 to create a new FuncWrapper object from inherited base classes: FrozenClass with example: obj = FuncWrapper(func, output_names, input_type, vectorized)