【问题标题】:How To Resolve Future Warning Errors [duplicate]如何解决未来的警告错误 [重复]
【发布时间】:2021-02-02 04:53:43
【问题描述】:

我正在使用 python 代码: dataReg=pd.DataFrame(data.loc[data['Store']=='1'])提取store 1的数据。

但遇到以下警告。

C:\Users\hp\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py:253: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  res_values = method(rvalues)

谁能建议如何解决这个问题?

【问题讨论】:

标签: python data-science


【解决方案1】:

在我看来,您正在将表中的 int 与代码中的字符串进行比较。尝试从语句中删除 ''。

另外,如果 data 已经是一个 DataFrame 你不需要再次使用 pd.DataFrame。

dataReg=data[data['Store']==1])

【讨论】:

    【解决方案2】:

    Future Warnings 只是一个小警告,无需关注 可以忽略不显示。

    试试这个代码:

    import warnings as w
    w.filterwarnings('ignore')
    

    【讨论】:

    • It can be ignored你有什么理由支持这个吗?
    猜你喜欢
    • 2017-08-05
    • 2017-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-24
    • 2013-04-29
    • 1970-01-01
    • 2014-06-26
    相关资源
    最近更新 更多