Beispiel #1
0
def validate_expanding_func(name, args, kwargs):
    numpy_args = ('axis', 'dtype', 'out')
    msg = ("numpy operations are not "
           "valid with window objects. "
           "Use .expanding(...).{func}() instead ".format(func=name))

    if len(args) > 0:
        raise UnsupportedFunctionCall(msg)

    for arg in numpy_args:
        if arg in kwargs:
            raise UnsupportedFunctionCall(msg)
Beispiel #2
0
def validate_groupby_func(name, args, kwargs):
    """
    'args' and 'kwargs' should be empty because all of
    their necessary parameters are explicitly listed in
    the function signature
    """
    if len(args) + len(kwargs) > 0:
        raise UnsupportedFunctionCall(("numpy operations are not valid "
                                       "with groupby. Use .groupby(...)."
                                       "{func}() instead".format(func=name)))
Beispiel #3
0
def validate_resampler_func(method, args, kwargs):
    """
    'args' and 'kwargs' should be empty because all of
    their necessary parameters are explicitly listed in
    the function signature
    """
    if len(args) + len(kwargs) > 0:
        if method in RESAMPLER_NUMPY_OPS:
            raise UnsupportedFunctionCall((
                "numpy operations are not valid "
                "with resample. Use .resample(...)."
                "{func}() instead".format(func=method)))
        else:
            raise TypeError("too many arguments passed in")