我知道有一些关于此的线程,但我在实际SettingWithCopyWarning本身上遇到了麻烦,所以它们都没有任何帮助。
我最近对我的机器进行了核攻击,并且正在重新安装 Pycharm 和所有库等。在运行我的一些脚本时,我不断收到与抑制SettingWithCopyWarning.
import warnings
from pandas.core.common import SettingWithCopyWarning
warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
Run Code Online (Sandbox Code Playgroud)
这些是我正在运行的行,它们会导致以下错误消息:
ImportError: cannot import name 'SettingWithCopyWarning' from 'pandas.core.common'
Run Code Online (Sandbox Code Playgroud)
我查看了该common.py文件,没有看到任何对SettingWithCopyWarning. 我使用的是 Python 3.8 和 Pandas 版本 1.5.3。
干杯