Odpowiedź @ bdiamante może tylko częściowo pomóc. Jeśli nadal otrzymujesz komunikat po zniesieniu ostrzeżeń, to dlatego, że pandassama biblioteka drukuje komunikat. Niewiele możesz z tym zrobić, chyba że samodzielnie edytujesz kod źródłowy Pandas. Może istnieje wewnętrzna opcja ich stłumienia lub sposób na zastąpienie pewnych rzeczy, ale nie mogłem go znaleźć.
Dla tych, którzy chcą wiedzieć, dlaczego ...
Załóżmy, że chcesz zapewnić czyste środowisko pracy. Na początku skryptu umieść pd.reset_option('all'). Dzięki Pandas 0.23.4 otrzymujesz:
>>> import pandas as pd
>>> pd.reset_option('all')
html.border has been deprecated, use display.html.border instead
(currently both are identical)
C:\projects\stackoverflow\venv\lib\site-packages\pandas\core\config.py:619: FutureWarning: html.bord
er has been deprecated, use display.html.border instead
(currently both are identical)
warnings.warn(d.msg, FutureWarning)
: boolean
use_inf_as_null had been deprecated and will be removed in a future
version. Use `use_inf_as_na` instead.
C:\projects\stackoverflow\venv\lib\site-packages\pandas\core\config.py:619: FutureWarning:
: boolean
use_inf_as_null had been deprecated and will be removed in a future
version. Use `use_inf_as_na` instead.
warnings.warn(d.msg, FutureWarning)
>>>
Zgodnie z radą @ bdiamante korzystasz z warningsbiblioteki. Teraz, zgodnie z tym, co mówi, ostrzeżenia zostały usunięte. Pozostało jednak kilka nieznośnych wiadomości:
>>> import warnings
>>> warnings.simplefilter(action='ignore', category=FutureWarning)
>>> import pandas as pd
>>> pd.reset_option('all')
html.border has been deprecated, use display.html.border instead
(currently both are identical)
: boolean
use_inf_as_null had been deprecated and will be removed in a future
version. Use `use_inf_as_na` instead.
>>>
W rzeczywistości wyłączenie wszystkich ostrzeżeń daje ten sam wynik:
>>> import warnings
>>> warnings.simplefilter(action='ignore', category=Warning)
>>> import pandas as pd
>>> pd.reset_option('all')
html.border has been deprecated, use display.html.border instead
(currently both are identical)
: boolean
use_inf_as_null had been deprecated and will be removed in a future
version. Use `use_inf_as_na` instead.
>>>
W sensie biblioteki standardowej nie są to prawdziwe ostrzeżenia . Pandy wdrażają swój własny system ostrzegawczy. Uruchomienie grep -rnkomunikatów ostrzegawczych pokazuje, że pandassystem ostrzegawczy jest zaimplementowany w core/config_init.py:
$ grep -rn "html.border has been deprecated"
core/config_init.py:207:html.border has been deprecated, use display.html.border instead
Dalsze pogoń pokazuje, że nie mam na to czasu. I prawdopodobnie też nie. Miejmy nadzieję, że to uchroni cię przed wpadnięciem do króliczej nory lub może zainspiruje kogoś do wymyślenia, jak naprawdę stłumić te wiadomości!
warnings....ignoreprzedimport pandas...aby spowodować, żeFutureWarningbędą ignorowane.