I am getting the following warning every time I import Pandas in any script
/usr/local/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
warnings.warn(self.msg_depr % (key, alt_key))
One example would be
>>> import pandas
/usr/local/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
warnings.warn(self.msg_depr % (key, alt_key))
I am running on OSX a "brewed" Python 2.7 with pandas==0.17.1 and matplotlib==1.5.0.
Thanks in advance
Comment From: TomAugspurger
I don't see any warnings with the same setup, and pandas doesn't import matplotlib at the top level. Are you sure that just typing import pandas
at the regular prompt (not IPython), and nothing else, causes the warning? Make sure you're not importing seaborn as well, which does raise this warning upon import.
Comment From: nuin
From the prompt, with Python only
Python 2.7.10 (default, Jul 13 2015, 12:05:58)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
/usr/local/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
warnings.warn(self.msg_depr % (key, alt_key))
>>>
Comment From: TomAugspurger
Strange. Make sure you don't have any files called pandas.py
in that directory. I'm curious what will happen if you uninstall matplotlib and try to import pandas again.
Comment From: jorisvandenbossche
I had today the same warning in a fresh environment with the same versions, but for me in the end it was due to importing seaborn. So can also not reproduce this by only importing pandas.
Can you do
import warnings
warnings.filterwarnings('error')
and show the error traceback. Possibly this can give more information on the source of the warning
Comment From: TomAugspurger
@nuin do you have a custom matplotlibrc
file? It turns out we try to import matplotlib at the top-level. In pandas.tools.plotting
we do import matplotlib in a try/except block. This gets run when you import pandas
because we attach the plotting methods at the top level here.
We don't actually access plt.rcParams['axes.color_cycle']
so I still don't think we're what's causing the warning, just triggering it. That's why I suspect you have a custom matplotlibrc file somewhere that's setting color_cycle
somewhere.
Comment From: mangecoeur
I had this problem and can confirm this is from using a custom matplotlibrc file. Not sure where would be a good place to document this
Comment From: manu2000
I had the same problem. I had a custom matplotlibrc file in the folder: 'C:\Users\username.matplotlib'. After making the following change I am not getting a warning anymore.
Change:
axes.color_cycle : 348ABD, 7A68A6, A60628, 467821, CF4457, 188487, E24A33
to
axes.prop_cycle : cycler('color', ['348ABD', '7A68A6', 'A60628', '467821', 'CF4457', '188487', 'E24A33'])
Comment From: jorisvandenbossche
Closing this issue as this does not seem to be an issue with pandas (but rather from importing seaborn or custom matplotlibrc)