gpt4 book ai didi

python - 弃用警告 : numpy. core.umath_tests

转载 作者:太空狗 更新时间:2023-10-30 00:09:01 29 4
gpt4 key购买 nike

我正在尝试运行下面的 python 脚本:

将 pandas 导入为 pd
从 sklearn.model_selection 导入 train_test_split
从 sklearn.ensemble 导入 RandomForestClassifier
从 sklearn.metrics 导入 accuracy_score从 sklearn.metrics 导入 confusion_matrix

它给了我下面的错误。

Warning (from warnings module): File "C:\Users\Dipali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\ensemble\weight_boosting.py", line 29 from numpy.core.umath_tests import inner1d DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.

我需要做什么?

最佳答案

您可以通过以下方式忽略警告

示例 1:

#!/usr/bin/env python -W ignore::DeprecationWarning

例子2:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

示例 3:

import warnings

def fxn():
warnings.warn("deprecated", DeprecationWarning)

with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()

关于python - 弃用警告 : numpy. core.umath_tests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51986414/

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