Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in running finacial_analysis.ipynb in chapter 7 #33

Closed
lxlofpku opened this issue Jan 22, 2023 · 2 comments
Closed

Errors in running finacial_analysis.ipynb in chapter 7 #33

lxlofpku opened this issue Jan 22, 2023 · 2 comments
Labels
troubleshooting Troubleshooting an issue

Comments

@lxlofpku
Copy link

Required attestation

  • [Y] I have completely and exactly followed the virtual environment setup instructions from the book and have consulted the README for any updates.
  • [Y] I have cloned either this repository or my fork of this repository so that I have all necessary files on my local machine.
  • [Y] I have checked that this issue has not already been reported or resolved here.
  • [Y] I am aware that there is a pre-built Binder environment that I can use, but I want to install locally on my machine instead.

Background information

1. Which OS are you using?

TODO: Provide your OS here – make sure to differentiate between Intel and M1 chip Macs.

Mac M2

2. Which Python version are you using?

TODO: Provide your Python version here.

Python 3.8

3. Are you using conda or venv?

TODO: Indicate whether you are using conda or venv.

conda


Commands run and their outputs

Please provide all of the commands you ran as well as the traceback:

Hi Stefanie:

Recently I installed the stock-analysis package following the instruction in chapter 7 (p. 395) of your book. That is, I installed it by running (in book_env environment):

  1. git clone [email protected]:stefmolin/stock-analysis.git
  2. pip3 install -r stock-analysis/requirements.txt
  3. pip3 install -e stock-analysis

All went through smoothly, indicating that the installation was successful.

However, as I run the finacial-analysis.ipynb notebook, I could not get the data. The problem is described in the attached screen shots. I have read through the trace back but cannot get a clue what is wrong.

Best regards,
Li-Xin

The problem is displayed in the the screen shots displaced below.

TODO: paste commands and any traceback here

Screenshots

Optionally, include any screenshots that will help diagnose the issue.
cap1
cap2

@lxlofpku lxlofpku added the troubleshooting Troubleshooting an issue label Jan 22, 2023
@stefmolin
Copy link
Owner

The stock_analysis library is using the pandas_datareader library to query the Yahoo! Finance API for the information. The API has recently changed, which is causing the issue since the pandas_datareader library doesn't yet know how to handle it. Upstream changes like this are expected, which is why I included all the datasets for this chapter in the data/ folder — use the note box right before "The Stock reader class" section in the book for a code snippet to read them in:

pd.read_csv('data/...', index_col='date', parse_dates=True)

@lxlofpku
Copy link
Author

The stock_analysis library is using the pandas_datareader library to query the Yahoo! Finance API for the information. The API has recently changed, which is causing the issue since the pandas_datareader library doesn't yet know how to handle it. Upstream changes like this are expected, which is why I included all the datasets for this chapter in the data/ folder — use the note box right before "The Stock reader class" section in the book for a code snippet to read them in:

pd.read_csv('data/...', index_col='date', parse_dates=True)

Hi Stefanie, I understand it now. Thanks a lot!

Repository owner locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
troubleshooting Troubleshooting an issue
Projects
None yet
Development

No branches or pull requests

2 participants