Get the Yahoo data in Python
18:42:54, June 11, 2018
Reading count: 71
I learned machine learning in Python. I found a practical tutorial online. I needed to get stock data from Yahoo. The problems and solutions are given below.
Programming environment: Linux Ubuntu16, python3.6, anaconda 1.6.14, conda 4.5.4, pandas 0.23
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Problem 1: An environment interpretation error occurred while downloading Pandas _datareader
Because the Yahoo data needs to be retrieved through the Pandas _datareader module, you need to download and install the package
Environment parse error occurs with Conda Install Pandas _datareader (conda installation is used because anaconda is used to build the Python compile and edit environment) :
[email protected]:~$ conda install pandas_datareader Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - pandas_datareader Current channels: - https://repo.anaconda.com/pkgs/main/linux-64 - https://repo.anaconda.com/pkgs/main/noarch - https://repo.anaconda.com/pkgs/free/linux-64 - https://repo.anaconda.com/pkgs/free/noarch - https://repo.anaconda.com/pkgs/r/linux-64 - https://repo.anaconda.com/pkgs/r/noarch - https://repo.anaconda.com/pkgs/pro/linux-64 - https://repo.anaconda.com/pkgs/pro/noarch To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page.
Solution 1: Then change to PIP Install safari _datareader to install successfully!
Solution two: Later, I found that when I was using Conda to install the module, there were jupyter Notebook still running, so I tried to close it and then used Conda install Rebuild _datareader to find it could be successfully installed.
Question 2: ImportError: Cannot import name ‘is_list_like’ when using import pandas_datareader as PDR
I found many methods on the Internet, including the case column on StackFlow, but I still couldn’t find one suitable for me.
Solution one: Then give up searching for a solution online and start groping instead. Because the error message is that the module named ‘is_list_like’ cannot be imported, the code to find the error is in the first line from pandas.core.common.data import is_list_like in the fred.py module. Because the common folder and the modules under that folder cannot be found in the environment, the path to import is_list_like is wrong.
Then, Baidu search: panda IS_list_like finds the official API document of Pandas, and click Source to enter the source code module. It turns out that IS_list_like exists as a method of in the following path
Finally, I get rid of the Fred. Py the first line of the import path into: from pandas. Core. Dtype. Inference import is_list_like, import pandas_datareader modules again success!
Question 3: run the following code, appear ImmediateDeprecationError, namely the Yahoo! Finance no longer exists because in 2017 Yahoo! It was bought by Verizon
Yahoo Daily has been immediately deprecated due to large breaks in the API without the introduction of a stable replacement
The code is as follows:
import pandas as pd
import pandas_datareader.data as web
start = datetime.datetime(
end = datetime.datetime(
df = web.get_data_yahoo(
Baidu has found one solution in the CSDN blog: install Fix_yahoo_finance (PIP Install) and then run the following code before retrieving the data.
import fix_yahoo_finance as fy
Reproduced in: https://www.cnblogs.com/ziheIT/p/9249676.html
- Data analysis to obtain Yahoo stock data: some problems are encountered when using panda datareader (cannot import name ‘is_ list_ Like ‘problem)
- Anaconda builds a new environment and installs sklearn, numpy and other modules
- Conda HTTP 000 CONNECTION FAILED for url
- Anaconda opens Navigator to report an error and a web page appears Navigator Error An unexpected error occurred on Navigator start-up Report
- CONDA HTTP error is prompted when Anaconda prompt is installed and updated
- Configuration (9) to solve the problem of “setup tools PIP wheel failed with error code 1”, create virtual environments with Python of anaconda
- pip install – PermissionError: [Errno 13] Permission denied
- Anaconda returns Python 3.7 to Python 3.6
- CONDA failed to create environment (collecting package metadata（repodata.json): failed)
- Tensorflow installation and uninstall (Anaconda version)
- How to solve “import cv2 failed ImportError: DLL load fail: Cannot find the specified module” in Anaconda environment
- Anaconda + vscode usage problem summary
- CONDA install torch error
- Installation of Python on MAC
- RemoveError: ‘setuptools’ is a dependency of conda and cannot be removed from conda’s operatin
- Install Seaborn, plot, Jieba in Anaconda
- Installing gensim in Anaconda
- Solution: Solving Environment: failed with initial frozen solve. Retrying with flexible solve
- (Solved) pytorch error: RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED (install cuda)
- Installing xgboost in anaconda is based on win10 32 / 64 bit system