Python скрыть / отключить предупреждения - PullRequest
0 голосов
/ 01 мая 2020

Как вы go скрываете следующие предупреждения?

Я написал следующее, но оно не работает:

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

Я также запускаю код, используя

%run -i "Admin_Vision_POC_Version_0_E.py" -W ignore

Вот список предупреждений, которые я получаю:

Admin_Vision_POC_Version_0_E.py:218: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  output = interactive_w2v_mode('w2v_model_bigdata',arg)
Admin_Vision_POC_Version_0_E.py:219: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

    See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
      maximumKey = max(output.items(), key=operator.itemgetter(1))[0]
    c:\Anaconda3\lib\site-packages\pandas\core\frame.py:4133: SettingWithCopyWarning: 
    A value is trying to be set on a copy of a slice from a DataFrame

    See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
      errors=errors,

1 Ответ

1 голос
/ 04 мая 2020

Я использовал следующий код для подавления предупреждений:

pd.options.mode.chained_assignment = None
...