I’m making my way through the Data Scientist in Python path, and I’m on the Visualizing Geographical Data mission. My code works fine in the DQ virtual machine, but when I try to run it locally in a Jupyter Notebook I get a deprecation warning. The warning doesn’t clearly tell me how to resolve the issue; can you help?
My code:
import pandas as pd
import matplotlib.pyplot as plt
# from pandas.plotting import register_matplotlib_converters
# register_matplotlib_converters()
from mpl_toolkits.basemap import Basemap
m = Basemap(projection='merc',llcrnrlat=-80,urcrnrlat=80,llcrnrlon=-180,urcrnrlon=180)
The warning when running the code:
/Users/Tom/miniconda2/lib/python3.7/site-packages/ipykernel_launcher.py:6: MatplotlibDeprecationWarning:
The dedent function was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use inspect.cleandoc instead.
Attempted resolution:
In a previous mission introducing Matplotlib, I got a similar warning that was more clear on how to resolve the issue, which was to add the following 2 lines of code:
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
Is there a similar bit of code I need to add for basemap to function in my local environment?
Thanks for the suggestion @Sahil. My versions seem to be up to date, and conda update matplotlib didn’t change anything. I also tried conda update basemap, but nothing there either. Maybe I should be using a different version of Python?
I’ll just continue on I guess, and ignore the warning for now.
The fix has been implemented on Basemap version 1.2.1 and the latest Basemap in Anaconda repository is 1.2.0. Therefore, either you can ignore the warning for now or install 1.2.1 from conda-forge:
Can you please let me know the basemap version in your Anaconda environment? Also, I would like to point out that Deprecation warnings are just warnings for something that will happen in the future, it won’t have any impact on the result of your code.