pandas.errors.UndefinedVariableError#
- exception pandas.errors.UndefinedVariableError(name, is_local=None)[源代码]#
在使用未定义变量名时,
query或eval引发的异常。它还将指明未定义的变量是本地的还是非本地的。
Examples
>>> df = pd.DataFrame({'A': [1, 1, 1]}) >>> df.query("A > x") ... # UndefinedVariableError: name 'x' is not defined >>> df.query("A > @y") ... # UndefinedVariableError: local variable 'y' is not defined >>> pd.eval('x + 1') ... # UndefinedVariableError: name 'x' is not defined