You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
File "init.py", line 839, in decorated_function
cache_key = decorated_function.make_cache_key(f, *args, **kwargs)
File "cache.py", line 30, in make_cache_key
keyargs, keykwargs = self._memoize_kwargs_to_args(
File "init.py", line 651, in _memoize_kwargs_to_args
arg_default = get_arg_default(f, i)
File "flask_caching/utils.py", line 42, in get_arg_default
return arg_def if arg_def != inspect.Parameter.empty else None
File "pandas/core/generic.py", line 1439, in nonzero
raise ValueError(
Expected:
Cache the function correctly.
Environment:
Python version: 3.9
Flask-Caching version: 2.0.2
The text was updated successfully, but these errors were encountered:
When you cache a function, that has a parameter, which has a default value of a DataFrame raises an Exception.
Minimal reproducible example:
@cache.memoize()
def foo(df=pd.DataFrame(), **kwargs):
print('Not reached')
Traceback:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
File "init.py", line 839, in decorated_function
cache_key = decorated_function.make_cache_key(f, *args, **kwargs)
File "cache.py", line 30, in make_cache_key
keyargs, keykwargs = self._memoize_kwargs_to_args(
File "init.py", line 651, in _memoize_kwargs_to_args
arg_default = get_arg_default(f, i)
File "flask_caching/utils.py", line 42, in get_arg_default
return arg_def if arg_def != inspect.Parameter.empty else None
File "pandas/core/generic.py", line 1439, in nonzero
raise ValueError(
Expected:
Cache the function correctly.
Environment:
The text was updated successfully, but these errors were encountered: