I'm aware there are a few threads about this but I'm having trouble with the actual SettingWithCopyWarning
itself so none of them are of any help.
I've recently nuked my machine and am in the process of reinstalling Pycharm and all the libraries etc. On running some of my scripts I keep getting an error to do with suppressing the SettingWithCopyWarning
.
import warnings
from pandas.core.common import SettingWithCopyWarning
warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
These are the lines I'm running, and they result in the following error message:
ImportError: cannot import name 'SettingWithCopyWarning' from 'pandas.core.common'
I've looked at the common.py
file and see no reference to the SettingWithCopyWarning
. I'm using Python 3.8, and Pandas version 1.5.3.
Cheers
Use pandas.errors.SettingWithCopyWarning
import warnings
from pandas.errors import SettingWithCopyWarning
warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
I strongly discourage you to hide this warning. This can lead to unexpected side effects and errors
Take the time to read How to deal with SettingWithCopyWarning in Pandas