I cannot import pandas_datareader due to the following error:
ImportError: cannot import name 'urlencode' from 'pandas.io.common'
How can I solve this problem?
I know that this question has already been asked, for instance here pandas_datareader, ImportError: cannot import name 'urlencode' but the solutions proposed there seem to not worked for me.
It's also possible that I am applying them in the wrong way (see below) but I do not know what I'm doing wrong.
Thank you very much for your help.
Some additional info:
- I'm using Python 3.9.1
- I have pandas_datareader 0.9 (the most recent version) according to Anaconda but pandas.show_versions() does not find any pandas_datareader module installed
- I have pandas 1.2.1 according to Anaconda (checked typing conda list in the terminal); but using the function pandas.show_versions() in the console it says me that I am using pandas 1.2.2 (A clarification also on this point is appreciated)
- I have tried (with no success) this solution suggested in a similar question:
import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader
- I have also tried (with no success) this other solution suggested in a similar question: replace
from pandas.io.common import urlencode
with
from urllib.parse import urlencode
in the file pandas_datareader/iex/init.py and pandas_datareader/base.py but I have checked the files and they are already correct.