Forums

pandas_datareader

I am trying to use the pandas datareader.

To set up my environment, I used: pip3 install pandas_datareader --user

The file I want to run only has the import: import pandas_datareader.data as web

File output: RuntimeError: implement_array_function method already has a docstring

How can I fix this error? Pandas datareader works file on my local copy of python, so is something about pythonanywhere preventing the pandas datareader from working?

Thanks in advance.

numpy has an issue where you cannot import it twice in the same process. In order to run your code more quickly when you use the "Run" button in the editor, we keep your original console process open and so, when you run the code for the second time, it breaks. You can kill the console between runs so that it starts fresh every time, or you can just run your code in a separate bash console, then you will not have this problem.

Ok thank you that makes sense. I am now testing it out in a python3.8 console before I try using a file.

I am running into another problem however. Console log below:

from pandas_datareader.nasdaq_trader import get_nasdaq_symbols

symbols = get_nasdaq_symbols()

Traceback (most recent call last): File "/home/Code7/.local/lib/python3.8/site-packages/pandas_datareader/nasdaq_trader.py", line 41, in _download_nasdaq_symbols ftp_session = FTP(_NASDAQ_FTP_SERVER, timeout=timeout) File "/usr/lib/python3.8/ftplib.py", line 117, in init self.connect(host) File "/usr/lib/python3.8/ftplib.py", line 152, in connect self.sock = socket.create_connection((self.host, self.port), self.timeout, File "/usr/lib/python3.8/socket.py", line 807, in create_connection raise err File "/usr/lib/python3.8/socket.py", line 796, in create_connection sock.connect(sa)

ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/Code7/.local/lib/python3.8/site-packages/pandas_datareader/nasdaq_trader.py", line 107, in get_nasdaq_symbols _ticker_cache = _download_nasdaq_symbols(timeout=timeout) File "/home/Code7/.local/lib/python3.8/site-packages/pandas_datareader/nasdaq_trader.py", line 44, in _download_nasdaq_symbols raise RemoteDataError("Error connecting to %r: %s" % (_NASDAQ_FTP_SERVER, err)) pandas_datareader._utils.RemoteDataError: Error connecting to 'ftp.nasdaqtrader.com': [Errno 111] Connection refused

I think the main issue is the line:

ConnectionRefusedError: [Errno 111] Connection refused

How can I fix this?

Free accounts can only access sites on our whitelist using http(s). If the site you're trying to access has an API, send us a link to the API documentation and we'll consider it for the whitelist.

Looking into the documentation for pandas_datareader, I found that it is making a request to the website

http://nasdaqtrader.com/dynamic/SymDir/nasdaqtraded.txt

I cannot find a documentation, it seems to just be a statically hosted file. The closest to docs that it has is the website it is hosted on,

http://ftp.nasdaqtrader.com/

It seems to be a legitimate stock data website, would it be possible for you to add it to the whitelist? I'd appreciate it.

We need a link to the docs so we can make sure that website is intended for programmatic use.