成功解决FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `ar

简介: 成功解决FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `ar

解决问题


stats.py:1633: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.

 return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval




解决思路


未来的警告:不建议使用非元组序列进行多维索引;使用“arr[tuple(seq)]”而不是“arr[seq]”。将来,这将被解释为一个数组索引' arr[np.array(seq)] ',它将导致错误或不同的结果。

 return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval




解决方法


此信息提示为警告,而不是error,即使不处理也不会影响代码编程的运行。如果想要去掉,可以更新库至最新版本!

然后根据提示修改使用方法!

如果想要去掉,可以根据提示采用改进的方法!


将arr[seq]改为arr[tuple(seq)]即可!


相关文章
|
4月前
|
机器学习/深度学习 数据处理 Python
【Python】已解决:FutureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated
【Python】已解决:FutureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated
51 0
|
6月前
|
JSON 数据格式
解决报错TypeError: Converting circular structure to JSON --> starting at object with constructor
解决报错TypeError: Converting circular structure to JSON --> starting at object with constructor
|
6月前
|
Python
完美解决丨+# TypeError: ‘dict_keys‘ object does not support indexing
完美解决丨+# TypeError: ‘dict_keys‘ object does not support indexing
|
搜索推荐 索引
Term Suggester 中 suggest_mode 的三种模式missing、popular、always 的区别
Term Suggester 中 suggest_mode 的三种模式missing、popular、always 的区别
Multiple substitutions specified in non-positional format; did you mean to add BUG(7)
Multiple substitutions specified in non-positional format; did you mean to add BUG(7)
|
TensorFlow 算法框架/工具
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
272 0
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
|
PyTorch 算法框架/工具
问题解决:AttributeError: 'module' object has no attribute '_rebuild_tensor_v2'
问题解决:AttributeError: 'module' object has no attribute '_rebuild_tensor_v2'
272 0
AttributeError: partially initialized module ‘jieba‘ has no attribute ‘cut‘ (most likely due to a ci
AttributeError: partially initialized module ‘jieba‘ has no attribute ‘cut‘ (most likely due to a ci
531 0
AttributeError: partially initialized module ‘jieba‘ has no attribute ‘cut‘ (most likely due to a ci
|
TensorFlow 算法框架/工具
成功解决AttributeError: module tensorflow.sets has no attribute intersection
成功解决AttributeError: module tensorflow.sets has no attribute intersection
成功解决AttributeError: module tensorflow.sets has no attribute intersection
|
TensorFlow 算法框架/工具
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​