Skip to content
Advertisement

Mute DEBUG alerts from ‘import pandas’ statement

I’m importing pandas and it continues to throw 7 DEBUG messages. It’s happening in JupyterLab and pythonanywhere. It does not appear when I comment out the pandas import

I tried to mute them using: warnings.filterwarnings(“ignore”), to no avail. Tried “from pandas import pandas as pd” to try and avoid any further import, etc.

from bs4 import BeautifulSoup
from oauth2client.service_account import ServiceAccountCredentials
from yahoo_oauth import OAuth2
from datetime import date, timedelta
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

import gspread
import smtplib
import time
import pandas
[2019-06-04 10:01:56,097 DEBUG] [matplotlib.__init__.wrapper] $HOME=/home/
[2019-06-04 10:01:56,104 DEBUG] [matplotlib.__init__.wrapper] matplotlib data path /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data
[2019-06-04 10:01:56,111 DEBUG] [matplotlib.__init__.rc_params_from_file] loaded rc file /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/matplotlibrc
[2019-06-04 10:01:56,126 DEBUG] [matplotlib.__init__.<module>] matplotlib version 2.2.2
[2019-06-04 10:01:56,126 DEBUG] [matplotlib.__init__.<module>] interactive is False
[2019-06-04 10:01:56,127 DEBUG] [matplotlib.__init__.<module>] platform is linux2
[2019-06-04 10:01:56,127 DEBUG] [matplotlib.__init__.<module>] loaded modules: ['requests.Cookie', 'pandas._libs.numpy',

… goes on for 100+ lines further

Advertisement

Answer

Try:

import logging
logging.basicConfig(level=logging.INFO)
import pandas

See https://docs.python.org/3/howto/logging.html#logging-basic-tutorial for more info on the logging module. It looks like something you are importing is setting the log level for you (or you are setting it yourself)

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement