gpt4 book ai didi

numpy - scipy binned 统计 future 警告

转载 作者:行者123 更新时间:2023-12-01 03:11:27 24 4
gpt4 key购买 nike

来自 scipy.stats 的函数合并统计引发警告:

/usr/local/lib/python3.5/dist-packages/scipy/stats/_binned_statistic.py:607:FutureWarning:不推荐使用非元组序列进行多维索引;使用 arr[tuple(seq)]而不是 arr[seq] .将来这将被解释为数组索引,arr[np.array(seq)] ,这将导致错误或不同的结果。
结果=结果[核心]

重现只需运行 stats.binned_statistics 文档示例:

values = [1.0, 1.0, 2.0, 1.5, 3.0]
st.binned_statistic([1, 1, 2, 5, 7], values, 'sum', bins=2)

我试图通过以下方式愚弄警告:
values = np.array((1.0, 1.0, 2.0, 1.5, 3.0))
st.binned_statistic(np.array((1, 1, 2, 5, 7)), values, 'sum', bins=2)

但似乎没有结果。如何在没有全局过滤 future 警告的情况下忽略此消息

scipy 1.1.0 numpy 1.15.0 python 3.5,ubuntu 16.04

最佳答案

忽略此警告是安全的,它特定于 scipy <=1.1.0 和 numpy >=1.15.0 的组合。
它应该在 scipy 1.2.0 发布时消失。

关于numpy - scipy binned 统计 future 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51837727/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com