Skip to content

Instantly share code, notes, and snippets.

@olp-cs
Last active April 19, 2017 19:03
Show Gist options
  • Save olp-cs/6745331 to your computer and use it in GitHub Desktop.
Save olp-cs/6745331 to your computer and use it in GitHub Desktop.
pandas demo: reading data from Yahoo
# Last updated: 2017
import pandas.io.data as web
# Read the stock price data from Yahoo
apple = web.DataReader('AAPL', 'yahoo', start = '01/01/2012', end = '25/10/2012')
# Display several lines
apple[0:5]
# Plot closing prices
apple['Close'].plot()
Copy link

ghost commented Apr 17, 2014

If I copy this in canopy there appears the error message:
NameError Traceback (most recent call last)
C:\Users\Paul\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.3.0.1715.win-x86\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc)

C:\Users\Paul\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.3.0.1715.win-x86\Lib\site-packages\IPython\utils\py3compat.py in ()
3
4 # Read the stock price data from Yahoo
----> 5 apple = DataReader('AAPL', 'yahoo', start = '01/01/2012', end = '25/10/2012')
6
7 # Display several lines

NameError: name 'DataReader' is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment