Suppressing Pandas dataframe plot output

I am plotting a dataframe:

        ax = df.plot()
        fig = ax.get_figure()
        fig.savefig("{}/{}ts.png".format(IMGPATH, series[pfxlen:]))

It works fine. But, on the console, I get:

/usr/lib64/python2.7/site-packages/matplotlib/axes.py:2542: UserWarning: Attempting to set identical left==right results in singular transformations; automatically expanding. left=736249.924955, right=736249.924955 + 'left=%s, right=%s') % (left, right))

Basic searching hasn't showed me how to solve this error. So, I want to suppress these errors, since they garbage up the console. How can I do this?

Upvotes: 0

Views: 606

Answers (1)

rubik
rubik

Reputation: 9104

Those aren't errors, but warnings. If you aren't concerned by those and just want to silence them, it's as simple as:

import warnings
warnings.filterwarnings('ignore')

Additionally, pandas and other libraries may trigger NumPY floating-point errors. If you encounter those, you have to silence them as well:

import numpy as np
np.seterr('ignore')

Upvotes: 3

Related Questions